diff --git a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-ja_UTF.mo b/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-ja_UTF.mo deleted file mode 100644 index 98b2976..0000000 Binary files a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-ja_UTF.mo and /dev/null differ diff --git a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-ja_UTF.po b/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-ja_UTF.po deleted file mode 100644 index df4124c..0000000 --- a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-ja_UTF.po +++ /dev/null @@ -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 \n" -"Language-Team: Leon Stafford \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のリモートパス" - diff --git a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-sp_UTF.mo b/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-sp_UTF.mo deleted file mode 100644 index 2fb1a79..0000000 Binary files a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-sp_UTF.mo and /dev/null differ diff --git a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-sp_UTF.po b/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-sp_UTF.po deleted file mode 100644 index 04fb385..0000000 --- a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin-sp_UTF.po +++ /dev/null @@ -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 \n" -"Language-Team: Leon Stafford \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" - diff --git a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin.pot b/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin.pot deleted file mode 100644 index fe7169b..0000000 --- a/wp-content/plugins/static-html-output-plugin/languages/static-html-output-plugin.pot +++ /dev/null @@ -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 \n" -"Language-Team: LANGUAGE \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 "" diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/AtRuleBlockList.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/AtRuleBlockList.php deleted file mode 100644 index 62e71a2..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/AtRuleBlockList.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/CSSBlockList.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/CSSBlockList.php deleted file mode 100644 index 7c9483f..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/CSSBlockList.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } } } } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/CSSList.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/CSSList.php deleted file mode 100644 index 3c7734b..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/CSSList.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/Document.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/Document.php deleted file mode 100644 index 358adbf..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/Document.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/KeyFrame.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/KeyFrame.php deleted file mode 100644 index e8bc935..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/CSSList/KeyFrame.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Comment/Comment.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Comment/Comment.php deleted file mode 100644 index 5f2bd8c..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Comment/Comment.php +++ /dev/null @@ -1,2 +0,0 @@ -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 . '*/'; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Comment/Commentable.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Comment/Commentable.php deleted file mode 100644 index 9faa6e8..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Comment/Commentable.php +++ /dev/null @@ -1,2 +0,0 @@ -$sFieldName)) { return $this->$sFieldName; } } return null; } public function set($aNames, $mValue) { $aVarPrefixes = array('a', 's', 'm', 'b', 'f', 'o', 'c', 'i'); if(is_string($aNames) && strpos($aNames, '*') !== false) { $aNames = array(str_replace('*', 'Before', $aNames), str_replace('*', 'Between', $aNames), str_replace('*', 'After', $aNames)); } else if(!is_array($aNames)) { $aNames = array($aNames); } foreach($aVarPrefixes as $sPrefix) { $bDidReplace = false; foreach($aNames as $sName) { $sFieldName = $sPrefix.ucfirst($sName); if(isset($this->$sFieldName)) { $this->$sFieldName = $mValue; $bDidReplace = true; } } if($bDidReplace) { return $this; } } return false; } public function __call($sMethodName, $aArguments) { if(strpos($sMethodName, 'set') === 0) { return $this->set(substr($sMethodName, 3), $aArguments[0]); } else if(strpos($sMethodName, 'get') === 0) { return $this->get(substr($sMethodName, 3)); } else if(method_exists('\\Sabberworm\\CSS\\OutputFormatter', $sMethodName)) { return call_user_func_array(array($this->getFormatter(), $sMethodName), $aArguments); } else { throw new \Exception('Unknown OutputFormat method called: '.$sMethodName); } } public function indentWithTabs($iNumber = 1) { return $this->setIndentation(str_repeat("\t", $iNumber)); } public function indentWithSpaces($iNumber = 2) { return $this->setIndentation(str_repeat(" ", $iNumber)); } public function nextLevel() { if($this->oNextLevelFormat === null) { $this->oNextLevelFormat = clone $this; $this->oNextLevelFormat->iIndentationLevel++; $this->oNextLevelFormat->oFormatter = null; } return $this->oNextLevelFormat; } public function beLenient() { $this->bIgnoreExceptions = true; } public function getFormatter() { if($this->oFormatter === null) { $this->oFormatter = new OutputFormatter($this); } return $this->oFormatter; } public function level() { return $this->iIndentationLevel; } public static function create() { return new OutputFormat(); } public static function createCompact() { return self::create()->set('Space*Rules', "")->set('Space*Blocks', "")->setSpaceAfterRuleName('')->setSpaceBeforeOpeningBrace('')->setSpaceAfterSelectorSeparator(''); } public static function createPretty() { return self::create()->set('Space*Rules', "\n")->set('Space*Blocks', "\n")->setSpaceBetweenBlocks("\n\n")->set('SpaceAfterListArgumentSeparator', array('default' => '', ',' => ' ')); } } class OutputFormatter { private $oFormat; public function __construct(OutputFormat $oFormat) { $this->oFormat = $oFormat; } public function space($sName, $sType = null) { $sSpaceString = $this->oFormat->get("Space$sName"); if(is_array($sSpaceString)) { if($sType !== null && isset($sSpaceString[$sType])) { $sSpaceString = $sSpaceString[$sType]; } else { $sSpaceString = reset($sSpaceString); } } return $this->prepareSpace($sSpaceString); } public function spaceAfterRuleName() { return $this->space('AfterRuleName'); } public function spaceBeforeRules() { return $this->space('BeforeRules'); } public function spaceAfterRules() { return $this->space('AfterRules'); } public function spaceBetweenRules() { return $this->space('BetweenRules'); } public function spaceBeforeBlocks() { return $this->space('BeforeBlocks'); } public function spaceAfterBlocks() { return $this->space('AfterBlocks'); } public function spaceBetweenBlocks() { return $this->space('BetweenBlocks'); } public function spaceBeforeSelectorSeparator() { return $this->space('BeforeSelectorSeparator'); } public function spaceAfterSelectorSeparator() { return $this->space('AfterSelectorSeparator'); } public function spaceBeforeListArgumentSeparator($sSeparator) { return $this->space('BeforeListArgumentSeparator', $sSeparator); } public function spaceAfterListArgumentSeparator($sSeparator) { return $this->space('AfterListArgumentSeparator', $sSeparator); } public function spaceBeforeOpeningBrace() { return $this->space('BeforeOpeningBrace'); } public function safely($cCode) { if($this->oFormat->get('IgnoreExceptions')) { try { return $cCode(); } catch (OutputException $e) { return null; } } else { return $cCode(); } } public function implode($sSeparator, $aValues, $bIncreaseLevel = false) { $sResult = ''; $oFormat = $this->oFormat; if($bIncreaseLevel) { $oFormat = $oFormat->nextLevel(); } $bIsFirst = true; foreach($aValues as $mValue) { if($bIsFirst) { $bIsFirst = false; } else { $sResult .= $sSeparator; } if($mValue instanceof \Sabberworm\CSS\Renderable) { $sResult .= $mValue->render($oFormat); } else { $sResult .= $mValue; } } return $sResult; } public function removeLastSemicolon($sString) { if($this->oFormat->get('SemicolonAfterLastRule')) { return $sString; } $sString = explode(';', $sString); if(count($sString) < 2) { return $sString[0]; } $sLast = array_pop($sString); $sNextToLast = array_pop($sString); array_push($sString, $sNextToLast.$sLast); return implode(';', $sString); } private function prepareSpace($sSpaceString) { return str_replace("\n", "\n".$this->indent(), $sSpaceString); } private function indent() { return str_repeat($this->oFormat->sIndentation, $this->oFormat->level()); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parser.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parser.php deleted file mode 100644 index c9252fc..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parser.php +++ /dev/null @@ -1,2 +0,0 @@ -sText = $sText; $this->iCurrentPosition = 0; $this->iLineNo = $iLineNo; if ($oParserSettings === null) { $oParserSettings = Settings::create(); } $this->oParserSettings = $oParserSettings; $this->blockRules = explode('/', AtRule::BLOCK_RULES); foreach (explode('/', Size::ABSOLUTE_SIZE_UNITS.'/'.Size::RELATIVE_SIZE_UNITS.'/'.Size::NON_SIZE_UNITS) as $val) { $iSize = strlen($val); if(!isset($this->aSizeUnits[$iSize])) { $this->aSizeUnits[$iSize] = array(); } $this->aSizeUnits[$iSize][strtolower($val)] = $val; } ksort($this->aSizeUnits, SORT_NUMERIC); } public function setCharset($sCharset) { $this->sCharset = $sCharset; $this->aText = $this->strsplit($this->sText); $this->iLength = count($this->aText); } public function getCharset() { return $this->sCharset; } public function parse() { $this->setCharset($this->oParserSettings->sDefaultCharset); $oResult = new Document($this->iLineNo); $this->parseDocument($oResult); return $oResult; } private function parseDocument(Document $oDocument) { $this->parseList($oDocument, true); } private function parseList(CSSList $oList, $bIsRoot = false) { while (!$this->isEnd()) { $comments = $this->consumeWhiteSpace(); $oListItem = null; if($this->oParserSettings->bLenientParsing) { try { $oListItem = $this->parseListItem($oList, $bIsRoot); } catch (UnexpectedTokenException $e) { $oListItem = false; } } else { $oListItem = $this->parseListItem($oList, $bIsRoot); } if($oListItem === null) { return; } if($oListItem) { $oListItem->setComments($comments); $oList->append($oListItem); } $this->consumeWhiteSpace(); } if (!$bIsRoot && !$this->oParserSettings->bLenientParsing) { throw new SourceException("Unexpected end of document", $this->iLineNo); } } private function parseListItem(CSSList $oList, $bIsRoot = false) { if ($this->comes('@')) { $oAtRule = $this->parseAtRule(); if($oAtRule instanceof Charset) { if(!$bIsRoot) { throw new UnexpectedTokenException('@charset may only occur in root document', '', 'custom', $this->iLineNo); } if(count($oList->getContents()) > 0) { throw new UnexpectedTokenException('@charset must be the first parseable token in a document', '', 'custom', $this->iLineNo); } $this->setCharset($oAtRule->getCharset()->getString()); } return $oAtRule; } else if ($this->comes('}')) { $this->consume('}'); if ($bIsRoot) { if ($this->oParserSettings->bLenientParsing) { while ($this->comes('}')) $this->consume('}'); return $this->parseSelector(); } else { throw new SourceException("Unopened {", $this->iLineNo); } } else { return null; } } else { return $this->parseSelector(); } } private function parseAtRule() { $this->consume('@'); $sIdentifier = $this->parseIdentifier(false); $iIdentifierLineNum = $this->iLineNo; $this->consumeWhiteSpace(); if ($sIdentifier === 'import') { $oLocation = $this->parseURLValue(); $this->consumeWhiteSpace(); $sMediaQuery = null; if (!$this->comes(';')) { $sMediaQuery = $this->consumeUntil(';'); } $this->consume(';'); return new Import($oLocation, $sMediaQuery, $iIdentifierLineNum); } else if ($sIdentifier === 'charset') { $sCharset = $this->parseStringValue(); $this->consumeWhiteSpace(); $this->consume(';'); return new Charset($sCharset, $iIdentifierLineNum); } else if ($this->identifierIs($sIdentifier, 'keyframes')) { $oResult = new KeyFrame($iIdentifierLineNum); $oResult->setVendorKeyFrame($sIdentifier); $oResult->setAnimationName(trim($this->consumeUntil('{', false, true))); $this->parseList($oResult); return $oResult; } else if ($sIdentifier === 'namespace') { $sPrefix = null; $mUrl = $this->parsePrimitiveValue(); if (!$this->comes(';')) { $sPrefix = $mUrl; $mUrl = $this->parsePrimitiveValue(); } $this->consume(';'); if ($sPrefix !== null && !is_string($sPrefix)) { throw new UnexpectedTokenException('Wrong namespace prefix', $sPrefix, 'custom', $iIdentifierLineNum); } if (!($mUrl instanceof CSSString || $mUrl instanceof URL)) { throw new UnexpectedTokenException('Wrong namespace url of invalid type', $mUrl, 'custom', $iIdentifierLineNum); } return new CSSNamespace($mUrl, $sPrefix, $iIdentifierLineNum); } else { $sArgs = trim($this->consumeUntil('{', false, true)); $bUseRuleSet = true; foreach($this->blockRules as $sBlockRuleName) { if($this->identifierIs($sIdentifier, $sBlockRuleName)) { $bUseRuleSet = false; break; } } if($bUseRuleSet) { $oAtRule = new AtRuleSet($sIdentifier, $sArgs, $iIdentifierLineNum); $this->parseRuleSet($oAtRule); } else { $oAtRule = new AtRuleBlockList($sIdentifier, $sArgs, $iIdentifierLineNum); $this->parseList($oAtRule); } return $oAtRule; } } private function parseIdentifier($bAllowFunctions = true, $bIgnoreCase = true) { $sResult = $this->parseCharacter(true); if ($sResult === null) { throw new UnexpectedTokenException($sResult, $this->peek(5), 'identifier', $this->iLineNo); } $sCharacter = null; while (($sCharacter = $this->parseCharacter(true)) !== null) { $sResult .= $sCharacter; } if ($bIgnoreCase) { $sResult = $this->strtolower($sResult); } if ($bAllowFunctions && $this->comes('(')) { $this->consume('('); $aArguments = $this->parseValue(array('=', ' ', ',')); $sResult = new CSSFunction($sResult, $aArguments, ',', $this->iLineNo); $this->consume(')'); } return $sResult; } private function parseStringValue() { $sBegin = $this->peek(); $sQuote = null; if ($sBegin === "'") { $sQuote = "'"; } else if ($sBegin === '"') { $sQuote = '"'; } if ($sQuote !== null) { $this->consume($sQuote); } $sResult = ""; $sContent = null; if ($sQuote === null) { while (!preg_match('/[\\s{}()<>\\[\\]]/isu', $this->peek())) { $sResult .= $this->parseCharacter(false); } } else { while (!$this->comes($sQuote)) { $sContent = $this->parseCharacter(false); if ($sContent === null) { throw new SourceException("Non-well-formed quoted string {$this->peek(3)}", $this->iLineNo); } $sResult .= $sContent; } $this->consume($sQuote); } return new CSSString($sResult, $this->iLineNo); } private function parseCharacter($bIsForIdentifier) { if ($this->peek() === '\\') { if ($bIsForIdentifier && $this->oParserSettings->bLenientParsing && ($this->comes('\0') || $this->comes('\9'))) { return null; } $this->consume('\\'); if ($this->comes('\n') || $this->comes('\r')) { return ''; } if (preg_match('/[0-9a-fA-F]/Su', $this->peek()) === 0) { return $this->consume(1); } $sUnicode = $this->consumeExpression('/^[0-9a-fA-F]{1,6}/u', 6); if ($this->strlen($sUnicode) < 6) { if (preg_match('/\\s/isSu', $this->peek())) { if ($this->comes('\r\n')) { $this->consume(2); } else { $this->consume(1); } } } $iUnicode = intval($sUnicode, 16); $sUtf32 = ""; for ($i = 0; $i < 4; ++$i) { $sUtf32 .= chr($iUnicode & 0xff); $iUnicode = $iUnicode >> 8; } return iconv('utf-32le', $this->sCharset, $sUtf32); } if ($bIsForIdentifier) { $peek = ord($this->peek()); if (($peek >= 97 && $peek <= 122) || ($peek >= 65 && $peek <= 90) || ($peek >= 48 && $peek <= 57) || ($peek === 45) || ($peek === 95) || ($peek > 0xa1)) { return $this->consume(1); } } else { return $this->consume(1); } return null; } private function parseSelector() { $aComments = array(); $oResult = new DeclarationBlock($this->iLineNo); $oResult->setSelector($this->consumeUntil('{', false, true, $aComments)); $oResult->setComments($aComments); $this->parseRuleSet($oResult); return $oResult; } private function parseRuleSet($oRuleSet) { while ($this->comes(';')) { $this->consume(';'); } while (!$this->comes('}')) { $oRule = null; if($this->oParserSettings->bLenientParsing) { try { $oRule = $this->parseRule(); } catch (UnexpectedTokenException $e) { try { $sConsume = $this->consumeUntil(array("\n", ";", '}'), true); if($this->streql(substr($sConsume, -1), '}')) { --$this->iCurrentPosition; } else { while ($this->comes(';')) { $this->consume(';'); } } } catch (UnexpectedTokenException $e) { return; } } } else { $oRule = $this->parseRule(); } if($oRule) { $oRuleSet->addRule($oRule); } } $this->consume('}'); } private function parseRule() { $aComments = $this->consumeWhiteSpace(); $oRule = new Rule($this->parseIdentifier(), $this->iLineNo); $oRule->setComments($aComments); $oRule->addComments($this->consumeWhiteSpace()); $this->consume(':'); $oValue = $this->parseValue(self::listDelimiterForRule($oRule->getRule())); $oRule->setValue($oValue); if ($this->oParserSettings->bLenientParsing) { while ($this->comes('\\')) { $this->consume('\\'); $oRule->addIeHack($this->consume()); $this->consumeWhiteSpace(); } } $this->consumeWhiteSpace(); if ($this->comes('!')) { $this->consume('!'); $this->consumeWhiteSpace(); $this->consume('important'); $oRule->setIsImportant(true); } $this->consumeWhiteSpace(); while ($this->comes(';')) { $this->consume(';'); } $this->consumeWhiteSpace(); return $oRule; } private function parseValue($aListDelimiters) { $aStack = array(); $this->consumeWhiteSpace(); while (!($this->comes('}') || $this->comes(';') || $this->comes('!') || $this->comes(')') || $this->comes('\\'))) { if (count($aStack) > 0) { $bFoundDelimiter = false; foreach ($aListDelimiters as $sDelimiter) { if ($this->comes($sDelimiter)) { array_push($aStack, $this->consume($sDelimiter)); $this->consumeWhiteSpace(); $bFoundDelimiter = true; break; } } if (!$bFoundDelimiter) { array_push($aStack, ' '); } } array_push($aStack, $this->parsePrimitiveValue()); $this->consumeWhiteSpace(); } foreach ($aListDelimiters as $sDelimiter) { if (count($aStack) === 1) { return $aStack[0]; } $iStartPosition = null; while (($iStartPosition = array_search($sDelimiter, $aStack, true)) !== false) { $iLength = 2; for ($i = $iStartPosition + 2; $i < count($aStack); $i+=2, ++$iLength) { if ($sDelimiter !== $aStack[$i]) { break; } } $oList = new RuleValueList($sDelimiter, $this->iLineNo); for ($i = $iStartPosition - 1; $i - $iStartPosition + 1 < $iLength * 2; $i+=2) { $oList->addListComponent($aStack[$i]); } array_splice($aStack, $iStartPosition - 1, $iLength * 2 - 1, array($oList)); } } return $aStack[0]; } private static function listDelimiterForRule($sRule) { if (preg_match('/^font($|-)/', $sRule)) { return array(',', '/', ' '); } return array(',', ' ', '/'); } private function parsePrimitiveValue() { $oValue = null; $this->consumeWhiteSpace(); if (is_numeric($this->peek()) || ($this->comes('-.') && is_numeric($this->peek(1, 2))) || (($this->comes('-') || $this->comes('.')) && is_numeric($this->peek(1, 1)))) { $oValue = $this->parseNumericValue(); } else if ($this->comes('#') || $this->comes('rgb', true) || $this->comes('hsl', true)) { $oValue = $this->parseColorValue(); } else if ($this->comes('url', true)) { $oValue = $this->parseURLValue(); } else if ($this->comes('calc', true) || $this->comes('-webkit-calc', true) || $this->comes('-moz-calc', true)) { $oValue = $this->parseCalcValue(); } else if ($this->comes("'") || $this->comes('"')) { $oValue = $this->parseStringValue(); } else if ($this->comes("progid:") && $this->oParserSettings->bLenientParsing) { $oValue = $this->parseMicrosoftFilter(); } else if ($this->comes("[")) { $oValue = $this->parseLineNameValue(); } else { $oValue = $this->parseIdentifier(true, false); } $this->consumeWhiteSpace(); return $oValue; } private function parseNumericValue($bForColor = false) { $sSize = ''; if ($this->comes('-')) { $sSize .= $this->consume('-'); } while (is_numeric($this->peek()) || $this->comes('.')) { if ($this->comes('.')) { $sSize .= $this->consume('.'); } else { $sSize .= $this->consume(1); } } $sUnit = null; foreach ($this->aSizeUnits as $iLength => &$aValues) { $sKey = strtolower($this->peek($iLength)); if(array_key_exists($sKey, $aValues)) { if (($sUnit = $aValues[$sKey]) !== null) { $this->consume($iLength); break; } } } return new Size(floatval($sSize), $sUnit, $bForColor, $this->iLineNo); } private function parseLineNameValue() { $this->consume('['); $this->consumeWhiteSpace(); $aNames = array(); do { if($this->oParserSettings->bLenientParsing) { try { $aNames[] = $this->parseIdentifier(false, true); } catch(UnexpectedTokenException $e) {} } else { $aNames[] = $this->parseIdentifier(false, true); } $this->consumeWhiteSpace(); } while (!$this->comes(']')); $this->consume(']'); return new LineName($aNames, $this->iLineNo); } private function parseColorValue() { $aColor = array(); if ($this->comes('#')) { $this->consume('#'); $sValue = $this->parseIdentifier(false); if ($this->strlen($sValue) === 3) { $sValue = $sValue[0] . $sValue[0] . $sValue[1] . $sValue[1] . $sValue[2] . $sValue[2]; } else if ($this->strlen($sValue) === 4) { $sValue = $sValue[0] . $sValue[0] . $sValue[1] . $sValue[1] . $sValue[2] . $sValue[2] . $sValue[3] . $sValue[3]; } if ($this->strlen($sValue) === 8) { $aColor = array('r' => new Size(intval($sValue[0] . $sValue[1], 16), null, true, $this->iLineNo), 'g' => new Size(intval($sValue[2] . $sValue[3], 16), null, true, $this->iLineNo), 'b' => new Size(intval($sValue[4] . $sValue[5], 16), null, true, $this->iLineNo), 'a' => new Size(round($this->mapRange(intval($sValue[6] . $sValue[7], 16), 0, 255, 0, 1), 2), null, true, $this->iLineNo)); } else { $aColor = array('r' => new Size(intval($sValue[0] . $sValue[1], 16), null, true, $this->iLineNo), 'g' => new Size(intval($sValue[2] . $sValue[3], 16), null, true, $this->iLineNo), 'b' => new Size(intval($sValue[4] . $sValue[5], 16), null, true, $this->iLineNo)); } } else { $sColorMode = $this->parseIdentifier(false); $this->consumeWhiteSpace(); $this->consume('('); $iLength = $this->strlen($sColorMode); for ($i = 0; $i < $iLength; ++$i) { $this->consumeWhiteSpace(); $aColor[$sColorMode[$i]] = $this->parseNumericValue(true); $this->consumeWhiteSpace(); if ($i < ($iLength - 1)) { $this->consume(','); } } $this->consume(')'); } return new Color($aColor, $this->iLineNo); } private function parseMicrosoftFilter() { $sFunction = $this->consumeUntil('(', false, true); $aArguments = $this->parseValue(array(',', '=')); return new CSSFunction($sFunction, $aArguments, ',', $this->iLineNo); } private function parseURLValue() { $bUseUrl = $this->comes('url', true); if ($bUseUrl) { $this->consume('url'); $this->consumeWhiteSpace(); $this->consume('('); } $this->consumeWhiteSpace(); $oResult = new URL($this->parseStringValue(), $this->iLineNo); if ($bUseUrl) { $this->consumeWhiteSpace(); $this->consume(')'); } return $oResult; } private function parseCalcValue() { $aOperators = array('+', '-', '*', '/'); $sFunction = trim($this->consumeUntil('(', false, true)); $oCalcList = new CalcRuleValueList($this->iLineNo); $oList = new RuleValueList(',', $this->iLineNo); $iNestingLevel = 0; $iLastComponentType = NULL; while(!$this->comes(')') || $iNestingLevel > 0) { $this->consumeWhiteSpace(); if ($this->comes('(')) { $iNestingLevel++; $oCalcList->addListComponent($this->consume(1)); continue; } else if ($this->comes(')')) { $iNestingLevel--; $oCalcList->addListComponent($this->consume(1)); continue; } if ($iLastComponentType != CalcFunction::T_OPERAND) { $oVal = $this->parsePrimitiveValue(); $oCalcList->addListComponent($oVal); $iLastComponentType = CalcFunction::T_OPERAND; } else { if (in_array($this->peek(), $aOperators)) { if (($this->comes('-') || $this->comes('+'))) { if ($this->peek(1, -1) != ' ' || !($this->comes('- ') || $this->comes('+ '))) { throw new UnexpectedTokenException(" {$this->peek()} ", $this->peek(1, -1) . $this->peek(2), 'literal', $this->iLineNo); } } $oCalcList->addListComponent($this->consume(1)); $iLastComponentType = CalcFunction::T_OPERATOR; } else { throw new UnexpectedTokenException(sprintf('Next token was expected to be an operand of type %s. Instead "%s" was found.', implode(', ', $aOperators), $oVal), '', 'custom', $this->iLineNo); } } } $oList->addListComponent($oCalcList); $this->consume(')'); return new CalcFunction($sFunction, $oList, ',', $this->iLineNo); } private function identifierIs($sIdentifier, $sMatch) { return (strcasecmp($sIdentifier, $sMatch) === 0) ?: preg_match("/^(-\\w+-)?$sMatch$/i", $sIdentifier) === 1; } private function comes($sString, $bCaseInsensitive = false) { $sPeek = $this->peek(strlen($sString)); return ($sPeek == '') ? false : $this->streql($sPeek, $sString, $bCaseInsensitive); } private function peek($iLength = 1, $iOffset = 0) { $iOffset += $this->iCurrentPosition; if ($iOffset >= $this->iLength) { return ''; } return $this->substr($iOffset, $iLength); } private function consume($mValue = 1) { if (is_string($mValue)) { $iLineCount = substr_count($mValue, "\n"); $iLength = $this->strlen($mValue); if (!$this->streql($this->substr($this->iCurrentPosition, $iLength), $mValue)) { throw new UnexpectedTokenException($mValue, $this->peek(max($iLength, 5)), $this->iLineNo); } $this->iLineNo += $iLineCount; $this->iCurrentPosition += $this->strlen($mValue); return $mValue; } else { if ($this->iCurrentPosition + $mValue > $this->iLength) { throw new UnexpectedTokenException($mValue, $this->peek(5), 'count', $this->iLineNo); } $sResult = $this->substr($this->iCurrentPosition, $mValue); $iLineCount = substr_count($sResult, "\n"); $this->iLineNo += $iLineCount; $this->iCurrentPosition += $mValue; return $sResult; } } private function consumeExpression($mExpression, $iMaxLength = null) { $aMatches = null; $sInput = $iMaxLength !== null ? $this->peek($iMaxLength) : $this->inputLeft(); if (preg_match($mExpression, $sInput, $aMatches, PREG_OFFSET_CAPTURE) === 1) { return $this->consume($aMatches[0][0]); } throw new UnexpectedTokenException($mExpression, $this->peek(5), 'expression', $this->iLineNo); } private function consumeWhiteSpace() { $comments = array(); do { while (preg_match('/\\s/isSu', $this->peek()) === 1) { $this->consume(1); } if($this->oParserSettings->bLenientParsing) { try { $oComment = $this->consumeComment(); } catch(UnexpectedTokenException $e) { $this->iCurrentPosition = $this->iLength; return; } } else { $oComment = $this->consumeComment(); } if ($oComment !== false) { $comments[] = $oComment; } } while($oComment !== false); return $comments; } private function consumeComment() { $mComment = false; if ($this->comes('/*')) { $iLineNo = $this->iLineNo; $this->consume(1); $mComment = ''; while (($char = $this->consume(1)) !== '') { $mComment .= $char; if ($this->comes('*/')) { $this->consume(2); break; } } } if ($mComment !== false) { return new Comment(substr($mComment, 1), $iLineNo); } return $mComment; } private function isEnd() { return $this->iCurrentPosition >= $this->iLength; } private function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false, array &$comments = array()) { $aEnd = is_array($aEnd) ? $aEnd : array($aEnd); $out = ''; $start = $this->iCurrentPosition; while (($char = $this->consume(1)) !== '') { if (in_array($char, $aEnd)) { if ($bIncludeEnd) { $out .= $char; } elseif (!$consumeEnd) { $this->iCurrentPosition -= $this->strlen($char); } return $out; } $out .= $char; if ($comment = $this->consumeComment()) { $comments[] = $comment; } } $this->iCurrentPosition = $start; throw new UnexpectedTokenException('One of ("'.implode('","', $aEnd).'")', $this->peek(5), 'search', $this->iLineNo); } private function inputLeft() { return $this->substr($this->iCurrentPosition, -1); } private function substr($iStart, $iLength) { if ($iLength < 0) { $iLength = $this->iLength - $iStart + $iLength; } if ($iStart + $iLength > $this->iLength) { $iLength = $this->iLength - $iStart; } $sResult = ''; while ($iLength > 0) { $sResult .= $this->aText[$iStart]; $iStart++; $iLength--; } return $sResult; } private function strlen($sString) { if ($this->oParserSettings->bMultibyteSupport) { return mb_strlen($sString, $this->sCharset); } else { return strlen($sString); } } private function streql($sString1, $sString2, $bCaseInsensitive = true) { if($bCaseInsensitive) { return $this->strtolower($sString1) === $this->strtolower($sString2); } else { return $sString1 === $sString2; } } private function strtolower($sString) { if ($this->oParserSettings->bMultibyteSupport) { return mb_strtolower($sString, $this->sCharset); } else { return strtolower($sString); } } private function strsplit($sString) { if ($this->oParserSettings->bMultibyteSupport) { if ($this->streql($this->sCharset, 'utf-8')) { return preg_split('//u', $sString, null, PREG_SPLIT_NO_EMPTY); } else { $iLength = mb_strlen($sString, $this->sCharset); $aResult = array(); for ($i = 0; $i < $iLength; ++$i) { $aResult[] = mb_substr($sString, $i, 1, $this->sCharset); } return $aResult; } } else { if($sString === '') { return array(); } else { return str_split($sString); } } } private function strpos($sString, $sNeedle, $iOffset) { if ($this->oParserSettings->bMultibyteSupport) { return mb_strpos($sString, $sNeedle, $iOffset, $this->sCharset); } else { return strpos($sString, $sNeedle, $iOffset); } } private function mapRange($fVal, $fFromMin, $fFromMax, $fToMin, $fToMax) { $fFromRange = $fFromMax - $fFromMin; $fToRange = $fToMax - $fToMin; $fMultiplier = $fToRange / $fFromRange; $fNewVal = $fVal - $fFromMin; $fNewVal *= $fMultiplier; return $fNewVal + $fToMin; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parsing/OutputException.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parsing/OutputException.php deleted file mode 100644 index ca24435..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parsing/OutputException.php +++ /dev/null @@ -1,2 +0,0 @@ -iLineNo = $iLineNo; if (!empty($iLineNo)) { $sMessage .= " [line no: $iLineNo]"; } parent::__construct($sMessage); } public function getLineNo() { return $this->iLineNo; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parsing/UnexpectedTokenException.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parsing/UnexpectedTokenException.php deleted file mode 100644 index 5f7b3e4..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Parsing/UnexpectedTokenException.php +++ /dev/null @@ -1,2 +0,0 @@ -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); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/AtRule.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/AtRule.php deleted file mode 100644 index a01eb1c..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/AtRule.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Charset.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Charset.php deleted file mode 100644 index 63149b1..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Charset.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Import.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Import.php deleted file mode 100644 index 2981f0e..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Import.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Selector.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Selector.php deleted file mode 100644 index 353c6bf..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Property/Selector.php +++ /dev/null @@ -1,25 +0,0 @@ -\~]+)[\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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Renderable.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Renderable.php deleted file mode 100644 index 657b647..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Renderable.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/AtRuleSet.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/AtRuleSet.php deleted file mode 100644 index acee661..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/AtRuleSet.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/DeclarationBlock.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/DeclarationBlock.php deleted file mode 100644 index 7accf9c..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/DeclarationBlock.php +++ /dev/null @@ -1,2 +0,0 @@ -aSelectors = array(); } public function setSelectors($mSelector) { if (is_array($mSelector)) { $this->aSelectors = $mSelector; } else { $this->aSelectors = explode(',', $mSelector); } foreach ($this->aSelectors as $iKey => $mSelector) { if (!($mSelector instanceof Selector)) { $this->aSelectors[$iKey] = new Selector($mSelector); } } } public function removeSelector($mSelector) { if($mSelector instanceof Selector) { $mSelector = $mSelector->getSelector(); } foreach($this->aSelectors as $iKey => $oSelector) { if($oSelector->getSelector() === $mSelector) { unset($this->aSelectors[$iKey]); return true; } } return false; } public function getSelector() { return $this->getSelectors(); } public function setSelector($mSelector) { $this->setSelectors($mSelector); } public function getSelectors() { return $this->aSelectors; } public function expandShorthands() { $this->expandBorderShorthand(); $this->expandDimensionsShorthand(); $this->expandFontShorthand(); $this->expandBackgroundShorthand(); $this->expandListStyleShorthand(); } public function createShorthands() { $this->createBackgroundShorthand(); $this->createDimensionsShorthand(); $this->createBorderShorthand(); $this->createFontShorthand(); $this->createListStyleShorthand(); } public function expandBorderShorthand() { $aBorderRules = array( 'border', 'border-left', 'border-right', 'border-top', 'border-bottom' ); $aBorderSizes = array( 'thin', 'medium', 'thick' ); $aRules = $this->getRulesAssoc(); foreach ($aBorderRules as $sBorderRule) { if (!isset($aRules[$sBorderRule])) continue; $oRule = $aRules[$sBorderRule]; $mRuleValue = $oRule->getValue(); $aValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aValues[] = $mRuleValue; } else { $aValues = $mRuleValue->getListComponents(); } foreach ($aValues as $mValue) { if ($mValue instanceof Value) { $mNewValue = clone $mValue; } else { $mNewValue = $mValue; } if ($mValue instanceof Size) { $sNewRuleName = $sBorderRule . "-width"; } else if ($mValue instanceof Color) { $sNewRuleName = $sBorderRule . "-color"; } else { if (in_array($mValue, $aBorderSizes)) { $sNewRuleName = $sBorderRule . "-width"; } else { $sNewRuleName = $sBorderRule . "-style"; } } $oNewRule = new Rule($sNewRuleName, $this->iLineNo); $oNewRule->setIsImportant($oRule->getIsImportant()); $oNewRule->addValue(array($mNewValue)); $this->addRule($oNewRule); } $this->removeRule($sBorderRule); } } public function expandDimensionsShorthand() { $aExpansions = array( 'margin' => 'margin-%s', 'padding' => 'padding-%s', 'border-color' => 'border-%s-color', 'border-style' => 'border-%s-style', 'border-width' => 'border-%s-width' ); $aRules = $this->getRulesAssoc(); foreach ($aExpansions as $sProperty => $sExpanded) { if (!isset($aRules[$sProperty])) continue; $oRule = $aRules[$sProperty]; $mRuleValue = $oRule->getValue(); $aValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aValues[] = $mRuleValue; } else { $aValues = $mRuleValue->getListComponents(); } $top = $right = $bottom = $left = null; switch (count($aValues)) { case 1: $top = $right = $bottom = $left = $aValues[0]; break; case 2: $top = $bottom = $aValues[0]; $left = $right = $aValues[1]; break; case 3: $top = $aValues[0]; $left = $right = $aValues[1]; $bottom = $aValues[2]; break; case 4: $top = $aValues[0]; $right = $aValues[1]; $bottom = $aValues[2]; $left = $aValues[3]; break; } foreach (array('top', 'right', 'bottom', 'left') as $sPosition) { $oNewRule = new Rule(sprintf($sExpanded, $sPosition), $this->iLineNo); $oNewRule->setIsImportant($oRule->getIsImportant()); $oNewRule->addValue(${$sPosition}); $this->addRule($oNewRule); } $this->removeRule($sProperty); } } public function expandFontShorthand() { $aRules = $this->getRulesAssoc(); if (!isset($aRules['font'])) return; $oRule = $aRules['font']; $aFontProperties = array( 'font-style' => 'normal', 'font-variant' => 'normal', 'font-weight' => 'normal', 'font-size' => 'normal', 'line-height' => 'normal' ); $mRuleValue = $oRule->getValue(); $aValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aValues[] = $mRuleValue; } else { $aValues = $mRuleValue->getListComponents(); } foreach ($aValues as $mValue) { if (!$mValue instanceof Value) { $mValue = mb_strtolower($mValue); } if (in_array($mValue, array('normal', 'inherit'))) { foreach (array('font-style', 'font-weight', 'font-variant') as $sProperty) { if (!isset($aFontProperties[$sProperty])) { $aFontProperties[$sProperty] = $mValue; } } } else if (in_array($mValue, array('italic', 'oblique'))) { $aFontProperties['font-style'] = $mValue; } else if ($mValue == 'small-caps') { $aFontProperties['font-variant'] = $mValue; } else if ( in_array($mValue, array('bold', 'bolder', 'lighter')) || ($mValue instanceof Size && in_array($mValue->getSize(), range(100, 900, 100))) ) { $aFontProperties['font-weight'] = $mValue; } else if ($mValue instanceof RuleValueList && $mValue->getListSeparator() == '/') { list($oSize, $oHeight) = $mValue->getListComponents(); $aFontProperties['font-size'] = $oSize; $aFontProperties['line-height'] = $oHeight; } else if ($mValue instanceof Size && $mValue->getUnit() !== null) { $aFontProperties['font-size'] = $mValue; } else { $aFontProperties['font-family'] = $mValue; } } foreach ($aFontProperties as $sProperty => $mValue) { $oNewRule = new Rule($sProperty, $this->iLineNo); $oNewRule->addValue($mValue); $oNewRule->setIsImportant($oRule->getIsImportant()); $this->addRule($oNewRule); } $this->removeRule('font'); } public function expandBackgroundShorthand() { $aRules = $this->getRulesAssoc(); if (!isset($aRules['background'])) return; $oRule = $aRules['background']; $aBgProperties = array( 'background-color' => array('transparent'), 'background-image' => array('none'), 'background-repeat' => array('repeat'), 'background-attachment' => array('scroll'), 'background-position' => array(new Size(0, '%', null, false, $this->iLineNo), new Size(0, '%', null, false, $this->iLineNo)) ); $mRuleValue = $oRule->getValue(); $aValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aValues[] = $mRuleValue; } else { $aValues = $mRuleValue->getListComponents(); } if (count($aValues) == 1 && $aValues[0] == 'inherit') { foreach ($aBgProperties as $sProperty => $mValue) { $oNewRule = new Rule($sProperty, $this->iLineNo); $oNewRule->addValue('inherit'); $oNewRule->setIsImportant($oRule->getIsImportant()); $this->addRule($oNewRule); } $this->removeRule('background'); return; } $iNumBgPos = 0; foreach ($aValues as $mValue) { if (!$mValue instanceof Value) { $mValue = mb_strtolower($mValue); } if ($mValue instanceof URL) { $aBgProperties['background-image'] = $mValue; } else if ($mValue instanceof Color) { $aBgProperties['background-color'] = $mValue; } else if (in_array($mValue, array('scroll', 'fixed'))) { $aBgProperties['background-attachment'] = $mValue; } else if (in_array($mValue, array('repeat', 'no-repeat', 'repeat-x', 'repeat-y'))) { $aBgProperties['background-repeat'] = $mValue; } else if (in_array($mValue, array('left', 'center', 'right', 'top', 'bottom')) || $mValue instanceof Size ) { if ($iNumBgPos == 0) { $aBgProperties['background-position'][0] = $mValue; $aBgProperties['background-position'][1] = 'center'; } else { $aBgProperties['background-position'][$iNumBgPos] = $mValue; } $iNumBgPos++; } } foreach ($aBgProperties as $sProperty => $mValue) { $oNewRule = new Rule($sProperty, $this->iLineNo); $oNewRule->setIsImportant($oRule->getIsImportant()); $oNewRule->addValue($mValue); $this->addRule($oNewRule); } $this->removeRule('background'); } public function expandListStyleShorthand() { $aListProperties = array( 'list-style-type' => 'disc', 'list-style-position' => 'outside', 'list-style-image' => 'none' ); $aListStyleTypes = array( 'none', 'disc', 'circle', 'square', 'decimal-leading-zero', 'decimal', 'lower-roman', 'upper-roman', 'lower-greek', 'lower-alpha', 'lower-latin', 'upper-alpha', 'upper-latin', 'hebrew', 'armenian', 'georgian', 'cjk-ideographic', 'hiragana', 'hira-gana-iroha', 'katakana-iroha', 'katakana' ); $aListStylePositions = array( 'inside', 'outside' ); $aRules = $this->getRulesAssoc(); if (!isset($aRules['list-style'])) return; $oRule = $aRules['list-style']; $mRuleValue = $oRule->getValue(); $aValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aValues[] = $mRuleValue; } else { $aValues = $mRuleValue->getListComponents(); } if (count($aValues) == 1 && $aValues[0] == 'inherit') { foreach ($aListProperties as $sProperty => $mValue) { $oNewRule = new Rule($sProperty, $this->iLineNo); $oNewRule->addValue('inherit'); $oNewRule->setIsImportant($oRule->getIsImportant()); $this->addRule($oNewRule); } $this->removeRule('list-style'); return; } foreach ($aValues as $mValue) { if (!$mValue instanceof Value) { $mValue = mb_strtolower($mValue); } if ($mValue instanceof Url) { $aListProperties['list-style-image'] = $mValue; } else if (in_array($mValue, $aListStyleTypes)) { $aListProperties['list-style-types'] = $mValue; } else if (in_array($mValue, $aListStylePositions)) { $aListProperties['list-style-position'] = $mValue; } } foreach ($aListProperties as $sProperty => $mValue) { $oNewRule = new Rule($sProperty, $this->iLineNo); $oNewRule->setIsImportant($oRule->getIsImportant()); $oNewRule->addValue($mValue); $this->addRule($oNewRule); } $this->removeRule('list-style'); } public function createShorthandProperties(array $aProperties, $sShorthand) { $aRules = $this->getRulesAssoc(); $aNewValues = array(); foreach ($aProperties as $sProperty) { if (!isset($aRules[$sProperty])) continue; $oRule = $aRules[$sProperty]; if (!$oRule->getIsImportant()) { $mRuleValue = $oRule->getValue(); $aValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aValues[] = $mRuleValue; } else { $aValues = $mRuleValue->getListComponents(); } foreach ($aValues as $mValue) { $aNewValues[] = $mValue; } $this->removeRule($sProperty); } } if (count($aNewValues)) { $oNewRule = new Rule($sShorthand, $this->iLineNo); foreach ($aNewValues as $mValue) { $oNewRule->addValue($mValue); } $this->addRule($oNewRule); } } public function createBackgroundShorthand() { $aProperties = array( 'background-color', 'background-image', 'background-repeat', 'background-position', 'background-attachment' ); $this->createShorthandProperties($aProperties, 'background'); } public function createListStyleShorthand() { $aProperties = array( 'list-style-type', 'list-style-position', 'list-style-image' ); $this->createShorthandProperties($aProperties, 'list-style'); } public function createBorderShorthand() { $aProperties = array( 'border-width', 'border-style', 'border-color' ); $this->createShorthandProperties($aProperties, 'border'); } public function createDimensionsShorthand() { $aPositions = array('top', 'right', 'bottom', 'left'); $aExpansions = array( 'margin' => 'margin-%s', 'padding' => 'padding-%s', 'border-color' => 'border-%s-color', 'border-style' => 'border-%s-style', 'border-width' => 'border-%s-width' ); $aRules = $this->getRulesAssoc(); foreach ($aExpansions as $sProperty => $sExpanded) { $aFoldable = array(); foreach ($aRules as $sRuleName => $oRule) { foreach ($aPositions as $sPosition) { if ($sRuleName == sprintf($sExpanded, $sPosition)) { $aFoldable[$sRuleName] = $oRule; } } } if (count($aFoldable) == 4) { $aValues = array(); foreach ($aPositions as $sPosition) { $oRule = $aRules[sprintf($sExpanded, $sPosition)]; $mRuleValue = $oRule->getValue(); $aRuleValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aRuleValues[] = $mRuleValue; } else { $aRuleValues = $mRuleValue->getListComponents(); } $aValues[$sPosition] = $aRuleValues; } $oNewRule = new Rule($sProperty, $this->iLineNo); if ((string) $aValues['left'][0] == (string) $aValues['right'][0]) { if ((string) $aValues['top'][0] == (string) $aValues['bottom'][0]) { if ((string) $aValues['top'][0] == (string) $aValues['left'][0]) { $oNewRule->addValue($aValues['top']); } else { $oNewRule->addValue($aValues['top']); $oNewRule->addValue($aValues['left']); } } else { $oNewRule->addValue($aValues['top']); $oNewRule->addValue($aValues['left']); $oNewRule->addValue($aValues['bottom']); } } else { $oNewRule->addValue($aValues['top']); $oNewRule->addValue($aValues['left']); $oNewRule->addValue($aValues['bottom']); $oNewRule->addValue($aValues['right']); } $this->addRule($oNewRule); foreach ($aPositions as $sPosition) { $this->removeRule(sprintf($sExpanded, $sPosition)); } } } } public function createFontShorthand() { $aFontProperties = array( 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', 'font-family' ); $aRules = $this->getRulesAssoc(); if (!isset($aRules['font-size']) || !isset($aRules['font-family'])) { return; } $oNewRule = new Rule('font', $this->iLineNo); foreach (array('font-style', 'font-variant', 'font-weight') as $sProperty) { if (isset($aRules[$sProperty])) { $oRule = $aRules[$sProperty]; $mRuleValue = $oRule->getValue(); $aValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aValues[] = $mRuleValue; } else { $aValues = $mRuleValue->getListComponents(); } if ($aValues[0] !== 'normal') { $oNewRule->addValue($aValues[0]); } } } $oRule = $aRules['font-size']; $mRuleValue = $oRule->getValue(); $aFSValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aFSValues[] = $mRuleValue; } else { $aFSValues = $mRuleValue->getListComponents(); } if (isset($aRules['line-height'])) { $oRule = $aRules['line-height']; $mRuleValue = $oRule->getValue(); $aLHValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aLHValues[] = $mRuleValue; } else { $aLHValues = $mRuleValue->getListComponents(); } if ($aLHValues[0] !== 'normal') { $val = new RuleValueList('/', $this->iLineNo); $val->addListComponent($aFSValues[0]); $val->addListComponent($aLHValues[0]); $oNewRule->addValue($val); } } else { $oNewRule->addValue($aFSValues[0]); } $oRule = $aRules['font-family']; $mRuleValue = $oRule->getValue(); $aFFValues = array(); if (!$mRuleValue instanceof RuleValueList) { $aFFValues[] = $mRuleValue; } else { $aFFValues = $mRuleValue->getListComponents(); } $oFFValue = new RuleValueList(',', $this->iLineNo); $oFFValue->setListComponents($aFFValues); $oNewRule->addValue($oFFValue); $this->addRule($oNewRule); foreach ($aFontProperties as $sProperty) { $this->removeRule($sProperty); } } public function __toString() { return $this->render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { if(count($this->aSelectors) === 0) { throw new OutputException("Attempt to print declaration block with missing selector", $this->iLineNo); } $sResult = $oOutputFormat->implode($oOutputFormat->spaceBeforeSelectorSeparator() . ',' . $oOutputFormat->spaceAfterSelectorSeparator(), $this->aSelectors) . $oOutputFormat->spaceBeforeOpeningBrace() . '{'; $sResult .= parent::render($oOutputFormat); $sResult .= '}'; return $sResult; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/RuleSet.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/RuleSet.php deleted file mode 100644 index f51def4..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/RuleSet/RuleSet.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Settings.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Settings.php deleted file mode 100644 index 2d689c5..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Settings.php +++ /dev/null @@ -1,2 +0,0 @@ -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); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CSSFunction.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CSSFunction.php deleted file mode 100644 index 6531a71..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CSSFunction.php +++ /dev/null @@ -1,2 +0,0 @@ -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})"; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CSSString.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CSSString.php deleted file mode 100644 index 92ff243..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CSSString.php +++ /dev/null @@ -1,2 +0,0 @@ -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(); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CalcFunction.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CalcFunction.php deleted file mode 100644 index 11e5238..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/CalcFunction.php +++ /dev/null @@ -1,2 +0,0 @@ -implode(' ', $this->aComponents); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/Color.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/Color.php deleted file mode 100644 index 65983f8..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/Color.php +++ /dev/null @@ -1,2 +0,0 @@ -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); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/LineName.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/LineName.php deleted file mode 100644 index d3c7f59..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/LineName.php +++ /dev/null @@ -1,2 +0,0 @@ -render(new \Sabberworm\CSS\OutputFormat()); } public function render(\Sabberworm\CSS\OutputFormat $oOutputFormat) { return '[' . parent::render(\Sabberworm\CSS\OutputFormat::createCompact()) . ']'; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/PrimitiveValue.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/PrimitiveValue.php deleted file mode 100644 index e175f88..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/PrimitiveValue.php +++ /dev/null @@ -1,2 +0,0 @@ -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); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/URL.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/URL.php deleted file mode 100644 index 3226f53..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/URL.php +++ /dev/null @@ -1,2 +0,0 @@ -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)})"; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/Value.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/Value.php deleted file mode 100644 index 2e73cc6..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/Value.php +++ /dev/null @@ -1,2 +0,0 @@ -iLineNo = $iLineNo; } public function getLineNo() { return $this->iLineNo; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/ValueList.php b/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/ValueList.php deleted file mode 100644 index 9f98719..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/CSSParser/Value/ValueList.php +++ /dev/null @@ -1,2 +0,0 @@ -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); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/FTP/FtpClient.php b/wp-content/plugins/static-html-output-plugin/plugin/FTP/FtpClient.php deleted file mode 100644 index 327e650..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/FTP/FtpClient.php +++ /dev/null @@ -1,2 +0,0 @@ -conn = $connection; } $this->setWrapper(new FtpWrapper($this->conn)); } public function __destruct() { if ($this->conn) { $this->ftp->close(); } } public function __call($method, array $arguments) { return $this->ftp->__call($method, $arguments); } public function help() { return $this->ftp->raw('help'); } public function connect($host, $ssl = false, $port = 21, $timeout = 90) { if ($ssl) { $this->conn = @$this->ftp->ssl_connect($host, $port, $timeout); } else { $this->conn = @$this->ftp->connect($host, $port, $timeout); } if (!$this->conn) { throw new FtpException('Unable to connect'); } return $this; } public function close() { if ($this->conn) { $this->ftp->close(); $this->conn = null; } } public function getConnection() { return $this->conn; } public function getWrapper() { return $this->ftp; } public function login($username = 'anonymous', $password = '') { $result = $this->ftp->login($username, $password); if ($result === false) { throw new FtpException('Login incorrect'); } return $this; } public function modifiedTime($remoteFile, $format = null) { $time = $this->ftp->mdtm($remoteFile); if ($time !== -1 && $format !== null) { return date($format, $time); } return $time; } public function up() { $result = @$this->ftp->cdup(); if ($result === false) { throw new FtpException('Unable to get parent folder'); } return $this; } public function nlist($directory = '.', $recursive = false, $filter = 'sort') { if (!$this->isDir($directory)) { throw new FtpException('"'.$directory.'" is not a directory'); } $files = $this->ftp->nlist($directory); if ($files === false) { throw new FtpException('Unable to list directory'); } $result = array(); $dir_len = strlen($directory); if (false !== ($kdot = array_search('.', $files))) { unset($files[$kdot]); } if(false !== ($kdot = array_search('..', $files))) { unset($files[$kdot]); } if (!$recursive) { foreach ($files as $file) { $result[] = $directory.'/'.$file; } $filter($result); return $result; } $flatten = function (array $arr) use (&$flatten) { $flat = array(); foreach ($arr as $k => $v) { if (is_array($v)) { $flat = array_merge($flat, $flatten($v)); } else { $flat[] = $v; } } return $flat; }; foreach ($files as $file) { $file = $directory.'/'.$file; if (0 === strpos($file, $directory, $dir_len)) { $file = substr($file, $dir_len); } if ($this->isDir($file)) { $result[] = $file; $items = $flatten($this->nlist($file, true, $filter)); foreach ($items as $item) { $result[] = $item; } } else { $result[] = $file; } } $result = array_unique($result); $filter($result); return $result; } public function mkdir($directory, $recursive = false) { if (!$recursive or $this->isDir($directory)) { return $this->ftp->mkdir($directory); } $result = false; $pwd = $this->ftp->pwd(); $parts = explode('/', $directory); foreach ($parts as $part) { if ($part == '') { continue; } if (!@$this->ftp->chdir($part)) { $result = $this->ftp->mkdir($part); $this->ftp->chdir($part); } } $this->ftp->chdir($pwd); return $result; } public function rmdir($directory, $recursive = true) { if ($recursive) { $files = $this->nlist($directory, false, 'rsort'); foreach ($files as $file) { $this->remove($file, true); } } return $this->ftp->rmdir($directory); } public function cleanDir($directory) { if(!$files = $this->nlist($directory)) { return $this->isEmpty($directory); } foreach ($files as $file) { $this->remove($file, true); } return $this->isEmpty($directory); } public function remove($path, $recursive = false) { try { if (@$this->ftp->delete($path) or ($this->isDir($path) and @$this->rmdir($path, $recursive))) { return true; } return false; } catch (\Exception $e) { return false; } } public function isDir($directory) { $pwd = $this->ftp->pwd(); if ($pwd === false) { throw new FtpException('Unable to resolve the current directory'); } if (@$this->ftp->chdir($directory)) { $this->ftp->chdir($pwd); return true; } $this->ftp->chdir($pwd); return false; } public function isEmpty($directory) { return $this->count($directory, null, false) === 0 ? true : false; } public function scanDir($directory = '.', $recursive = false) { return $this->parseRawList($this->rawlist($directory, $recursive)); } public function dirSize($directory = '.', $recursive = true) { $items = $this->scanDir($directory, $recursive); $size = 0; foreach ($items as $item) { $size += (int) $item['size']; } return $size; } public function count($directory = '.', $type = null, $recursive = true) { $items = (null === $type ? $this->nlist($directory, $recursive) : $this->scanDir($directory, $recursive)); $count = 0; foreach ($items as $item) { if (null === $type or $item['type'] == $type) { $count++; } } return $count; } public function putFromString($remote_file, $content) { $handle = fopen('php://temp', 'w'); fwrite($handle, $content); rewind($handle); if ($this->ftp->fput($remote_file, $handle, FTP_BINARY)) { return $this; } throw new FtpException('Unable to put the file "'.$remote_file.'"'); } public function putFromPath($local_file) { $remote_file = basename($local_file); $handle = fopen($local_file, 'r'); if ($this->ftp->fput($remote_file, $handle, FTP_BINARY)) { rewind($handle); return $this; } throw new FtpException( 'Unable to put the remote file from the local file "'.$local_file.'"' ); } public function putAll($source_directory, $target_directory, $mode = FTP_BINARY) { $d = dir($source_directory); while ($file = $d->read()) { if ($file != "." && $file != "..") { if (is_dir($source_directory.'/'.$file)) { if (!$this->isDir($target_directory.'/'.$file)) { $this->ftp->mkdir($target_directory.'/'.$file); } $this->putAll( $source_directory.'/'.$file, $target_directory.'/'.$file, $mode ); } else { $this->ftp->put( $target_directory.'/'.$file, $source_directory.'/'.$file, $mode ); } } } return $this; } public function rawlist($directory = '.', $recursive = false) { if (!$this->isDir($directory)) { throw new FtpException('"'.$directory.'" is not a directory.'); } $list = $this->ftp->rawlist($directory); $items = array(); if (!$list) { return $items; } if (false == $recursive) { foreach ($list as $path => $item) { $chunks = preg_split("/\s+/", $item); if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') { continue; } $path = $directory.'/'.$chunks[8]; if (isset($chunks[9])) { $nbChunks = count($chunks); for ($i = 9; $i < $nbChunks; $i++) { $path .= ' '.$chunks[$i]; } } if (substr($path, 0, 2) == './') { $path = substr($path, 2); } $items[ $this->rawToType($item).'#'.$path ] = $item; } return $items; } $path = ''; foreach ($list as $item) { $len = strlen($item); if (!$len || ($item[$len-1] == '.' && $item[$len-2] == ' ' or $item[$len-1] == '.' && $item[$len-2] == '.' && $item[$len-3] == ' ') ){ continue; } $chunks = preg_split("/\s+/", $item); if (empty($chunks[8]) || $chunks[8] == '.' || $chunks[8] == '..') { continue; } $path = $directory.'/'.$chunks[8]; if (isset($chunks[9])) { $nbChunks = count($chunks); for ($i = 9; $i < $nbChunks; $i++) { $path .= ' '.$chunks[$i]; } } if (substr($path, 0, 2) == './') { $path = substr($path, 2); } $items[$this->rawToType($item).'#'.$path] = $item; if ($item[0] == 'd') { $sublist = $this->rawlist($path, true); foreach ($sublist as $subpath => $subitem) { $items[$subpath] = $subitem; } } } return $items; } public function parseRawList(array $rawlist) { $items = array(); $path = ''; foreach ($rawlist as $key => $child) { $chunks = preg_split("/\s+/", $child); if (isset($chunks[8]) && ($chunks[8] == '.' or $chunks[8] == '..')) { continue; } if (count($chunks) === 1) { $len = strlen($chunks[0]); if ($len && $chunks[0][$len-1] == ':') { $path = substr($chunks[0], 0, -1); } continue; } $item = [ 'permissions' => $chunks[0], 'number' => $chunks[1], 'owner' => $chunks[2], 'group' => $chunks[3], 'size' => $chunks[4], 'month' => $chunks[5], 'day' => $chunks[6], 'time' => $chunks[7], 'name' => $chunks[8], 'type' => $this->rawToType($chunks[0]), ]; if ($item['type'] == 'link') { $item['target'] = $chunks[10]; } if (is_int($key) || false === strpos($key, $item['name'])) { array_splice($chunks, 0, 8); $key = $item['type'].'#' .($path ? $path.'/' : '') .implode(" ", $chunks); if ($item['type'] == 'link') { $exp = explode(' ->', $key); $key = rtrim($exp[0]); } $items[$key] = $item; } else { $items[$key] = $item; } } return $items; } public function rawToType($permission) { if (!is_string($permission)) { throw new FtpException('The "$permission" argument must be a string, "' .gettype($permission).'" given.'); } if (empty($permission[0])) { return 'unknown'; } switch ($permission[0]) { case '-': return 'file'; case 'd': return 'directory'; case 'l': return 'link'; default: return 'unknown'; } } protected function setWrapper(FtpWrapper $wrapper) { $this->ftp = $wrapper; return $this; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/FTP/FtpException.php b/wp-content/plugins/static-html-output-plugin/plugin/FTP/FtpException.php deleted file mode 100644 index 3101352..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/FTP/FtpException.php +++ /dev/null @@ -1,2 +0,0 @@ -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); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/URL2/URL2.php b/wp-content/plugins/static-html-output-plugin/plugin/URL2/URL2.php deleted file mode 100644 index 0d43f20..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/URL2/URL2.php +++ /dev/null @@ -1,2 +0,0 @@ - true, self::OPTION_USE_BRACKETS => true, self::OPTION_DROP_SEQUENCE => true, self::OPTION_ENCODE_KEYS => true, self::OPTION_SEPARATOR_INPUT => '&', self::OPTION_SEPARATOR_OUTPUT => '&', ); private $_scheme = false; private $_userinfo = false; private $_host = false; private $_port = false; private $_path = ''; private $_query = false; private $_fragment = false; public function __construct($url, array $options = array()) { foreach ($options as $optionName => $value) { if (array_key_exists($optionName, $this->_options)) { $this->_options[$optionName] = $value; } } $this->parseUrl($url); } public function __set($var, $arg) { $method = 'set' . $var; if (method_exists($this, $method)) { $this->$method($arg); } } public function __get($var) { $method = 'get' . $var; if (method_exists($this, $method)) { return $this->$method(); } return false; } public function getScheme() { return $this->_scheme; } public function setScheme($scheme) { $this->_scheme = $scheme; return $this; } public function getUser() { return $this->_userinfo !== false ? preg_replace('(:.*$)', '', $this->_userinfo) : false; } public function getPassword() { return $this->_userinfo !== false ? substr(strstr($this->_userinfo, ':'), 1) : false; } public function getUserinfo() { return $this->_userinfo; } public function setUserinfo($userinfo, $password = false) { if ($password !== false) { $userinfo .= ':' . $password; } if ($userinfo !== false) { $userinfo = $this->_encodeData($userinfo); } $this->_userinfo = $userinfo; return $this; } public function getHost() { return $this->_host; } public function setHost($host) { $this->_host = $host; return $this; } public function getPort() { return $this->_port; } public function setPort($port) { $this->_port = $port; return $this; } public function getAuthority() { if (false === $this->_host) { return false; } $authority = ''; if (strlen($this->_userinfo)) { $authority .= $this->_userinfo . '@'; } $authority .= $this->_host; if ($this->_port !== false) { $authority .= ':' . $this->_port; } return $authority; } public function setAuthority($authority) { $this->_userinfo = false; $this->_host = false; $this->_port = false; if ('' === $authority) { $this->_host = $authority; return $this; } if (!preg_match('(^(([^@]*)@)?(.+?)(:(\d*))?$)', $authority, $matches)) { return $this; } if ($matches[1]) { $this->_userinfo = $this->_encodeData($matches[2]); } $this->_host = $matches[3]; if (isset($matches[5]) && strlen($matches[5])) { $this->_port = $matches[5]; } return $this; } public function getPath() { return $this->_path; } public function setPath($path) { $this->_path = $path; return $this; } public function getQuery() { return $this->_query; } public function setQuery($query) { $this->_query = $query; return $this; } public function getFragment() { return $this->_fragment; } public function setFragment($fragment) { $this->_fragment = $fragment; return $this; } public function getQueryVariables() { $separator = $this->getOption(self::OPTION_SEPARATOR_INPUT); $encodeKeys = $this->getOption(self::OPTION_ENCODE_KEYS); $useBrackets = $this->getOption(self::OPTION_USE_BRACKETS); $return = array(); for ($part = strtok($this->_query, $separator); strlen($part); $part = strtok($separator) ) { list($key, $value) = explode('=', $part, 2) + array(1 => ''); if ($encodeKeys) { $key = rawurldecode($key); } $value = rawurldecode($value); if ($useBrackets) { $return = $this->_queryArrayByKey($key, $value, $return); } else { if (isset($return[$key])) { $return[$key] = (array) $return[$key]; $return[$key][] = $value; } else { $return[$key] = $value; } } } return $return; } private function _queryArrayByKey($key, $value, array $array = array()) { if (!strlen($key)) { return $array; } $offset = $this->_queryKeyBracketOffset($key); if ($offset === false) { $name = $key; } else { $name = substr($key, 0, $offset); } if (!strlen($name)) { return $array; } if (!$offset) { $array[$name] = $value; } else { $brackets = substr($key, $offset); if (!isset($array[$name])) { $array[$name] = null; } $array[$name] = $this->_queryArrayByBrackets( $brackets, $value, $array[$name] ); } return $array; } private function _queryArrayByBrackets($buffer, $value, array $array = null) { $entry = &$array; for ($iteration = 0; strlen($buffer); $iteration++) { $open = $this->_queryKeyBracketOffset($buffer); if ($open !== 0) { if ($iteration) { break; } throw new Exception( 'Net_URL2 Internal Error: '. __METHOD__ .'(): ' . 'Opening bracket [ must exist at offset 0' ); } $close = strpos($buffer, ']', 1); if (!$close) { throw new Exception( 'Net_URL2 Internal Error: '. __METHOD__ .'(): ' . 'Closing bracket ] must exist, not found' ); } $index = substr($buffer, 1, $close - 1); if (strlen($index)) { $entry = &$entry[$index]; } else { if (!is_array($entry)) { $entry = array(); } $entry[] = &$new; $entry = &$new; unset($new); } $buffer = substr($buffer, $close + 1); } $entry = $value; return $array; } private function _queryKeyBracketOffset($key) { if (false !== $open = strpos($key, '[') and false === strpos($key, ']', $open + 1) ) { $open = false; } return $open; } public function setQueryVariables(array $array) { if (!$array) { $this->_query = false; } else { $this->_query = $this->buildQuery( $array, $this->getOption(self::OPTION_SEPARATOR_OUTPUT) ); } return $this; } public function setQueryVariable($name, $value) { $array = $this->getQueryVariables(); $array[$name] = $value; $this->setQueryVariables($array); return $this; } public function unsetQueryVariable($name) { $array = $this->getQueryVariables(); unset($array[$name]); $this->setQueryVariables($array); } public function getURL() { $url = ''; if ($this->_scheme !== false) { $url .= $this->_scheme . ':'; } $authority = $this->getAuthority(); if ($authority === false && strtolower($this->_scheme) === 'file') { $authority = ''; } $url .= $this->_buildAuthorityAndPath($authority, $this->_path); if ($this->_query !== false) { $url .= '?' . $this->_query; } if ($this->_fragment !== false) { $url .= '#' . $this->_fragment; } return $url; } private function _buildAuthorityAndPath($authority, $path) { if ($authority === false) { return $path; } $terminator = ($path !== '' && $path[0] !== '/') ? '/' : ''; return '//' . $authority . $terminator . $path; } public function __toString() { return $this->getURL(); } public function getNormalizedURL() { $url = clone $this; $url->normalize(); return $url->getURL(); } public function normalize() { if ($this->_scheme) { $this->_scheme = strtolower($this->_scheme); } if ($this->_host) { $this->_host = strtolower($this->_host); } if ('' === $this->_port || $this->_port && $this->_scheme && $this->_port == getservbyname($this->_scheme, 'tcp') ) { $this->_port = false; } $fields = array(&$this->_userinfo, &$this->_host, &$this->_path, &$this->_query, &$this->_fragment); foreach ($fields as &$field) { if ($field !== false) { $field = $this->_normalize("$field"); } } unset($field); $this->_path = self::removeDotSegments($this->_path); if (false !== $this->_host && '' === $this->_path) { $this->_path = '/'; } if (strlen($this->getAuthority()) && strlen($this->_path) && $this->_path[0] !== '/' ) { $this->_path = '/' . $this->_path; } } private function _normalize($mixed) { return preg_replace_callback( '((?:%[0-9a-fA-Z]{2})+)', array($this, '_normalizeCallback'), $mixed ); } private function _normalizeCallback($matches) { return self::urlencode(urldecode($matches[0])); } public function isAbsolute() { return (bool) $this->_scheme; } public function resolve($reference) { if (!$reference instanceof Net_URL2) { $reference = new self($reference); } if (!$reference->_isFragmentOnly() && !$this->isAbsolute()) { throw new Exception( 'Base-URL must be absolute if reference is not fragment-only' ); } if (!$this->getOption(self::OPTION_STRICT) && $reference->_scheme == $this->_scheme ) { $reference->_scheme = false; } $target = new self(''); if ($reference->_scheme !== false) { $target->_scheme = $reference->_scheme; $target->setAuthority($reference->getAuthority()); $target->_path = self::removeDotSegments($reference->_path); $target->_query = $reference->_query; } else { $authority = $reference->getAuthority(); if ($authority !== false) { $target->setAuthority($authority); $target->_path = self::removeDotSegments($reference->_path); $target->_query = $reference->_query; } else { if ($reference->_path == '') { $target->_path = $this->_path; if ($reference->_query !== false) { $target->_query = $reference->_query; } else { $target->_query = $this->_query; } } else { if (substr($reference->_path, 0, 1) == '/') { $target->_path = self::removeDotSegments($reference->_path); } else { if ($this->_host !== false && $this->_path == '') { $target->_path = '/' . $reference->_path; } else { $i = strrpos($this->_path, '/'); if ($i !== false) { $target->_path = substr($this->_path, 0, $i + 1); } $target->_path .= $reference->_path; } $target->_path = self::removeDotSegments($target->_path); } $target->_query = $reference->_query; } $target->setAuthority($this->getAuthority()); } $target->_scheme = $this->_scheme; } $target->_fragment = $reference->_fragment; return $target; } private function _isFragmentOnly() { return ( $this->_fragment !== false && $this->_query === false && $this->_path === '' && $this->_port === false && $this->_host === false && $this->_userinfo === false && $this->_scheme === false ); } public static function removeDotSegments($path) { $path = (string) $path; $output = ''; $loopLimit = 256; $j = 0; while ('' !== $path && $j++ < $loopLimit) { if (substr($path, 0, 2) === './') { $path = substr($path, 2); } elseif (substr($path, 0, 3) === '../') { $path = substr($path, 3); } elseif (substr($path, 0, 3) === '/./' || $path === '/.') { $path = '/' . substr($path, 3); } elseif (substr($path, 0, 4) === '/../' || $path === '/..') { $path = '/' . substr($path, 4); $i = strrpos($output, '/'); $output = $i === false ? '' : substr($output, 0, $i); } elseif ($path === '.' || $path === '..') { $path = ''; } else { $i = strpos($path, '/', $path[0] === '/'); if ($i === false) { $output .= $path; $path = ''; break; } $output .= substr($path, 0, $i); $path = substr($path, $i); } } if ($path !== '') { $message = sprintf( 'Unable to remove dot segments; hit loop limit %d (left: %s)', $j, var_export($path, true) ); trigger_error($message, E_USER_WARNING); } return $output; } public static function urlencode($string) { $encoded = rawurlencode($string); $encoded = str_replace('%7E', '~', $encoded); return $encoded; } public static function getCanonical() { if (!isset($_SERVER['REQUEST_METHOD'])) { throw new Exception('Script was not called through a webserver'); } $url = new self($_SERVER['PHP_SELF']); $url->_scheme = isset($_SERVER['HTTPS']) ? 'https' : 'http'; $url->_host = $_SERVER['SERVER_NAME']; $port = $_SERVER['SERVER_PORT']; if ($url->_scheme == 'http' && $port != 80 || $url->_scheme == 'https' && $port != 443 ) { $url->_port = $port; } return $url; } public static function getRequestedURL() { return self::getRequested()->getUrl(); } public static function getRequested() { if (!isset($_SERVER['REQUEST_METHOD'])) { throw new Exception('Script was not called through a webserver'); } $url = new self($_SERVER['REQUEST_URI']); $url->_scheme = isset($_SERVER['HTTPS']) ? 'https' : 'http'; $url->setAuthority($_SERVER['HTTP_HOST']); return $url; } public function getOption($optionName) { return isset($this->_options[$optionName]) ? $this->_options[$optionName] : false; } protected function buildQuery(array $data, $separator, $key = null) { $query = array(); $drop_names = ( $this->_options[self::OPTION_DROP_SEQUENCE] === true && array_keys($data) === array_keys(array_values($data)) ); foreach ($data as $name => $value) { if ($this->getOption(self::OPTION_ENCODE_KEYS) === true) { $name = rawurlencode($name); } if ($key !== null) { if ($this->getOption(self::OPTION_USE_BRACKETS) === true) { $drop_names && $name = ''; $name = $key . '[' . $name . ']'; } else { $name = $key; } } if (is_array($value)) { $query[] = $this->buildQuery($value, $separator, $name); } else { $query[] = $name . '=' . rawurlencode($value); } } return implode($separator, $query); } protected function parseUrl($url) { preg_match( '(^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)', $url, $matches ); $this->_scheme = !empty($matches[1]) ? $matches[2] : false; $this->setAuthority(!empty($matches[3]) ? $matches[4] : false); $this->_path = $this->_encodeData($matches[5]); $this->_query = !empty($matches[6]) ? $this->_encodeData($matches[7]) : false ; $this->_fragment = !empty($matches[8]) ? $matches[9] : false; } private function _encodeData($url) { return preg_replace_callback( '([\x-\x20\x22\x3C\x3E\x7F-\xFF]+)', array($this, '_encodeCallback'), $url ); } private function _encodeCallback(array $matches) { return rawurlencode($matches[0]); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static.php deleted file mode 100644 index 8605f25..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static.php +++ /dev/null @@ -1,2 +0,0 @@ -options = new WP2Static_Options( self::OPTIONS_KEY ); self::$instance->view = new WP2Static_View(); } return self::$instance; } public static function init( $bootstrap_file ) { $instance = self::getInstance(); register_activation_hook( $bootstrap_file, array( $instance, 'activate' ) ); if ( is_admin() ) { add_action( 'admin_menu', array( $instance, 'registerOptionsPage', ) ); add_filter( 'custom_menu_order', '__return_true' ); add_filter( 'menu_order', array( $instance, 'set_menu_order' ) ); } return $instance; } public function set_menu_order( $menu_order ) { $order = array(); $file = plugin_basename( __FILE__ ); foreach ( $menu_order as $index => $item ) { if ( $item === 'index.php' ) { $order[] = $item; } } $order = array( 'index.php', 'wp2static', ); return $order; } public function setDefaultOptions() { if ( null === $this->options->getOption( 'version' ) ) { $this->options ->setOption( 'version', self::VERSION ) ->setOption( 'static_export_settings', self::VERSION ) ->setOption( 'rewriteWPPaths', '1' ) ->setOption( 'removeConditionalHeadComments', '1' ) ->setOption( 'removeWPMeta', '1' ) ->setOption( 'removeWPLinks', '1' ) ->setOption( 'removeHTMLComments', '1' ) ->save(); } } public function activate_for_single_site() { $this->setDefaultOptions(); } public function activate( $network_wide ) { if ( $network_wide ) { global $wpdb; $query = 'SELECT blog_id FROM %s WHERE site_id = %d;'; $site_ids = $wpdb->get_col( sprintf( $query, $wpdb->blogs, $wpdb->siteid ) ); foreach ( $site_ids as $site_id ) { switch_to_blog( $site_id ); $this->activate_for_single_site(); } restore_current_blog(); } else { $this->activate_for_single_site(); } } public function registerOptionsPage() { $plugins_url = plugin_dir_url( dirname( __FILE__ ) ); $page = add_menu_page( __( 'WP2Static', 'static-html-output-plugin' ), __( 'WP2Static', 'static-html-output-plugin' ), 'manage_options', self::HOOK, array( self::$instance, 'renderOptionsPage' ), 'dashicons-shield-alt' ); add_action( 'admin_print_styles-' . $page, array( $this, 'enqueueAdminStyles', ) ); } public function enqueueAdminStyles() { $plugins_url = plugin_dir_url( dirname( __FILE__ ) ); wp_enqueue_style( self::HOOK . '-admin', $plugins_url . 'wp2static.css?sdf=sdfd', null, $this::VERSION ); } public function finalize_deployment() { require_once dirname( __FILE__ ) . '/WP2Static/Deployer.php'; $deployer = new Deployer(); $deployer->finalizeDeployment(); echo 'SUCCESS'; } public function generate_filelist_preview() { require_once dirname( __FILE__ ) . '/WP2Static/WPSite.php'; $this->wp_site = new WPSite(); $target_settings = array( 'general', 'crawling', ); if ( defined( 'WP_CLI' ) ) { require_once dirname( __FILE__ ) . '/WP2Static/DBSettings.php'; $this->settings = WPSHO_DBSettings::get( $target_settings ); } else { require_once dirname( __FILE__ ) . '/WP2Static/PostSettings.php'; $this->settings = WPSHO_PostSettings::get( $target_settings ); } $plugin_hook = 'wp2static'; $initial_file_list_count = WP2Static_FilesHelper::buildInitialFileList( true, $this->wp_site->wp_uploads_path, $this->wp_site->uploads_url, $this->settings ); if ( ! defined( 'WP_CLI' ) ) { echo $initial_file_list_count; } } public function renderOptionsPage() { require_once dirname( __FILE__ ) . '/WP2Static/WPSite.php'; $this->wp_site = new WPSite(); $this->current_archive = ''; $this->view ->setTemplate( 'options-page-js' ) ->assign( 'options', $this->options ) ->assign( 'wp_site', $this->wp_site ) ->assign( 'onceAction', self::HOOK . '-options' ) ->render(); $this->view ->setTemplate( 'options-page' ) ->assign( 'wp_site', $this->wp_site ) ->assign( 'options', $this->options ) ->assign( 'onceAction', self::HOOK . '-options' ) ->render(); } public function userIsAllowed() { $referred_by_admin = check_admin_referer( self::HOOK . '-options' ); $user_can_manage_options = current_user_can( 'manage_options' ); return $referred_by_admin && $user_can_manage_options; } public function save_options() { if ( ! $this->userIsAllowed() ) { exit( 'Not allowed to change plugin options.' ); } $this->options->saveAllPostData(); } public function prepare_for_export() { require_once dirname( __FILE__ ) . '/WP2Static/Exporter.php'; $this->exporter = new Exporter(); $this->exporter->pre_export_cleanup(); $this->exporter->cleanup_leftover_archives(); $this->exporter->initialize_cache_files(); require_once dirname( __FILE__ ) . '/WP2Static/Archive.php'; $archive = new Archive(); $archive->create(); $this->logEnvironmentalInfo(); $this->exporter->generateModifiedFileList(); if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } public function reset_default_settings() { if ( ! delete_option( 'wp2static-options' ) ) { error_log( "Couldn't reset plugin to default settings" ); } $this->options = new WP2Static_Options( self::OPTIONS_KEY ); $this->setDefaultOptions(); echo 'SUCCESS'; } public function post_process_archive_dir() { require_once dirname( __FILE__ ) . '/WP2Static/ArchiveProcessor.php'; $processor = new ArchiveProcessor(); $processor->createNetlifySpecialFiles(); $processor->renameArchiveDirectories(); $processor->removeWPCruft(); $processor->copyStaticSiteToPublicFolder(); $processor->create_zip(); if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } public function delete_deploy_cache() { $target_settings = array( 'wpenv', ); if ( defined( 'WP_CLI' ) ) { require_once dirname( __FILE__ ) . '/WP2Static/DBSettings.php'; $this->settings = WPSHO_DBSettings::get( $target_settings ); } else { require_once dirname( __FILE__ ) . '/WP2Static/PostSettings.php'; $this->settings = WPSHO_PostSettings::get( $target_settings ); } $uploads_dir = $this->settings['wp_uploads_path']; $cache_files = array( '/WP2STATIC-GITLAB-PREVIOUS-HASHES.txt', '/WP2STATIC-GITHUB-PREVIOUS-HASHES.txt', '/WP2STATIC-S3-PREVIOUS-HASHES.txt', '/WP2STATIC-BUNNYCDN-PREVIOUS-HASHES.txt', '/WP2STATIC-BITBUCKET-PREVIOUS-HASHES.txt', '/WP2STATIC-FTP-PREVIOUS-HASHES.txt', ); foreach ( $cache_files as $cache_file ) { if ( is_file( $uploads_dir . $cache_file ) ) { unlink( $uploads_dir . $cache_file ); } } if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } public function logEnvironmentalInfo() { $info = array( '' . date( 'Y-m-d h:i:s' ), 'PHP VERSION ' . phpversion(), 'OS VERSION ' . php_uname(), 'WP VERSION ' . get_bloginfo( 'version' ), 'WP URL ' . get_bloginfo( 'url' ), 'WP SITEURL ' . get_option( 'siteurl' ), 'WP HOME ' . get_option( 'home' ), 'WP ADDRESS ' . get_bloginfo( 'wpurl' ), 'PLUGIN VERSION ' . $this::VERSION, 'VIA WP-CLI? ' . defined( 'WP_CLI' ), 'STATIC EXPORT URL ' . $this->exporter->settings['baseUrl'], 'PERMALINK STRUCTURE ' . get_option( 'permalink_structure' ), ); if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) { $info[] = 'SERVER SOFTWARE ' . $_SERVER['SERVER_SOFTWARE']; } WsLog::l( implode( PHP_EOL, $info ) ); WsLog::l( 'Active plugins:' ); $active_plugins = get_option( 'active_plugins' ); foreach ( $active_plugins as $active_plugin ) { WsLog::l( $active_plugin ); } WsLog::l( 'Plugin options:' ); $options = $this->options->getAllOptions( false ); foreach ( $options as $key => $value ) { WsLog::l( "{$value['Option name']}: {$value['Value']}" ); } WsLog::l( 'Installed extensions:' ); $extensions = get_loaded_extensions(); foreach ( $extensions as $extension ) { WsLog::l( $extension ); } } } diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Archive.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Archive.php deleted file mode 100644 index 3198900..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Archive.php +++ /dev/null @@ -1,2 +0,0 @@ -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 ); } } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/ArchiveProcessor.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/ArchiveProcessor.php deleted file mode 100644 index 70e1ee5..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/ArchiveProcessor.php +++ /dev/null @@ -1,2 +0,0 @@ -archive = new Archive(); $this->archive->setToCurrentArchive(); $this->loadSettings( array( 'wpenv', 'crawling', 'advanced', 'processing', 'netlify', 'zip', 'folder', ) ); } public function renameWPDirectory( $source, $target ) { if ( empty( $source ) || empty( $target ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'Failed trying to rename: ' . 'Source: ' . $source . ' to: ' . $target ); die(); } $original_dir = $this->archive->path . $source; $new_dir = $this->archive->path . $target; if ( is_dir( $original_dir ) ) { $this->recursive_copy( $original_dir, $new_dir ); WP2Static_FilesHelper::delete_dir_with_files( $original_dir ); } else { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'Trying to rename non-existent directory: ' . $original_dir ); } } public function recursive_copy( $srcdir, $dstdir ) { $dir = opendir( $srcdir ); if ( ! is_dir( $dstdir ) ) { mkdir( $dstdir ); } while ( $file = readdir( $dir ) ) { if ( $file != '.' && $file != '..' ) { $src = $srcdir . '/' . $file; $dst = $dstdir . '/' . $file; if ( is_dir( $src ) ) { $this->recursive_copy( $src, $dst ); } else { copy( $src, $dst ); } } } closedir( $dir ); } public function dir_is_empty( $dirname ) { if ( ! is_dir( $dirname ) ) { return false; } $dotfiles = array( '.', '..', '/.wp2static_safety' ); foreach ( scandir( $dirname ) as $file ) { if ( ! in_array( $file, $dotfiles ) ) { return false; } } return true; } public function dir_has_safety_file( $dirname ) { if ( ! is_dir( $dirname ) ) { return false; } foreach ( scandir( $dirname ) as $file ) { if ( $file == '.wp2static_safety' ) { return true; } } return false; } public function put_safety_file( $dirname ) { if ( ! is_dir( $dirname ) ) { return false; } $safety_file = $dirname . '/.wp2static_safety'; $result = file_put_contents( $safety_file, 'wp2static' ); chmod( $safety_file, 0664 ); return $result; } public function copyStaticSiteToPublicFolder() { if ( $this->settings['selected_deployment_option'] === 'folder' ) { $target_folder = trim( $this->settings['targetFolder'] ); $this->target_folder = $target_folder; if ( ! $target_folder ) { return; } $directory_exists = true; $directory_empty = false; $dir_has_safety_file = false; $directory_exists = is_dir( $target_folder ); if ( $directory_exists ) { $directory_empty = $this->dir_is_empty( $target_folder ); } else { if ( wp_mkdir_p( $target_folder ) ) { if ( ! $this->put_safety_file( $target_folder ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'Couldn\'t put safety file in ' . 'Target Directory' . $target_folder ); die(); } } else { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'Couldn\'t create Target Directory: ' . $target_folder ); die(); } } if ( $directory_empty ) { if ( ! $this->put_safety_file( $target_folder ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'Couldn\'t put safety file in ' . 'Target Directory' . $target_folder ); die(); } } $dir_has_safety_file = $this->dir_has_safety_file( $target_folder ); if ( $directory_empty || $dir_has_safety_file ) { $this->recursive_copy( $this->archive->path, $this->target_folder ); if ( ! $this->put_safety_file( $target_folder ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'Couldn\'t put safety file in ' . 'Target Directory' . $target_folder ); die(); } } else { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'Target Directory wasn\'t empty ' . 'or didn\'t contain safety file ' . $target_folder ); die(); } } } public function createNetlifySpecialFiles() { if ( $this->settings['selected_deployment_option'] !== 'netlify' ) { return false; } if ( isset( $this->settings['netlifyRedirects'] ) ) { $redirect_content = $this->settings['netlifyRedirects']; $redirect_path = $this->archive->path . '_redirects'; file_put_contents( $redirect_path, $redirect_content ); chmod( $redirect_path, 0664 ); } if ( isset( $this->settings['netlifyHeaders'] ) ) { $header_content = $this->settings['netlifyHeaders']; $header_path = $this->archive->path . '_headers'; file_put_contents( $header_path, $header_content ); chmod( $header_path, 0664 ); } } public function create_zip() { $deployer = $this->settings['selected_deployment_option']; if ( ! in_array( $deployer, array( 'zip', 'netlify' ) ) ) { return; } $archive_path = rtrim( $this->archive->path, '/' ); $temp_zip = $archive_path . '.tmp'; $zip_archive = new ZipArchive(); if ( $zip_archive->open( $temp_zip, ZIPARCHIVE::CREATE ) !== true ) { return new WP_Error( 'Could not create archive' ); } $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $this->archive->path ) ); foreach ( $iterator as $filename => $file_object ) { $base_name = basename( $filename ); if ( $base_name != '.' && $base_name != '..' ) { if ( ! $zip_archive->addFile( realpath( $filename ), str_replace( $this->archive->path, '', $filename ) ) ) { return new WP_Error( 'Could not add file: ' . $filename ); } } } $zip_archive->close(); $zip_path = $this->settings['wp_uploads_path'] . '/' . $this->archive->name . '.zip'; rename( $temp_zip, $zip_path ); } public function removeWPCruft() { if ( file_exists( $this->archive->path . '/xmlrpc.php' ) ) { unlink( $this->archive->path . '/xmlrpc.php' ); } if ( file_exists( $this->archive->path . '/wp-login.php' ) ) { unlink( $this->archive->path . '/wp-login.php' ); } WP2Static_FilesHelper::delete_dir_with_files( $this->archive->path . '/wp-json/' ); } public function renameArchiveDirectories() { if ( ! isset( $this->settings['rename_rules'] ) ) { return; } $rename_rules = explode( "\n", str_replace( "\r", '', $this->settings['rename_rules'] ) ); foreach ( $rename_rules as $rename_rule_line ) { list($original_dir, $target_dir) = explode( ',', $rename_rule_line ); $this->renameWPDirectory( $original_dir, $target_dir ); } } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/CSSProcessor.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/CSSProcessor.php deleted file mode 100644 index 1cbc1e6..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/CSSProcessor.php +++ /dev/null @@ -1,2 +0,0 @@ -loadSettings( array( 'crawling', 'wpenv', 'processing', 'advanced', ) ); } public function processCSS( $css_document, $page_url ) { if ( $css_document == '' ) { return false; } $path = dirname( __FILE__ ) . '/../CSSParser/'; require_once $path . 'Parser.php'; require_once $path . 'Settings.php'; require_once $path . 'Renderable.php'; require_once $path . 'OutputFormat.php'; require_once $path . 'Comment/Comment.php'; require_once $path . 'Comment/Commentable.php'; require_once $path . 'Parsing/SourceException.php'; require_once $path . 'Parsing/OutputException.php'; require_once $path . 'Parsing/UnexpectedTokenException.php'; require_once $path . 'Property/AtRule.php'; require_once $path . 'Property/Charset.php'; require_once $path . 'Property/CSSNamespace.php'; require_once $path . 'Property/Import.php'; require_once $path . 'Property/Selector.php'; require_once $path . 'RuleSet/RuleSet.php'; require_once $path . 'Rule/Rule.php'; require_once $path . 'RuleSet/AtRuleSet.php'; require_once $path . 'RuleSet/DeclarationBlock.php'; require_once $path . 'Value/Value.php'; require_once $path . 'Value/ValueList.php'; require_once $path . 'Value/RuleValueList.php'; require_once $path . 'Value/CSSFunction.php'; require_once $path . 'Value/CalcFunction.php'; require_once $path . 'Value/CalcRuleValueList.php'; require_once $path . 'Value/PrimitiveValue.php'; require_once $path . 'Value/Color.php'; require_once $path . 'Value/CSSString.php'; require_once $path . 'Value/LineName.php'; require_once $path . 'Value/Size.php'; require_once $path . 'Value/URL.php'; require_once $path . 'CSSList/CSSList.php'; require_once $path . 'CSSList/CSSBlockList.php'; require_once $path . 'CSSList/AtRuleBlockList.php'; require_once $path . 'CSSList/Document.php'; require_once $path . 'CSSList/KeyFrame.php'; $protocol = $this->getTargetSiteProtocol( $this->settings['baseUrl'] ); $this->placeholder_url = $protocol . 'PLACEHOLDER.wpsho/'; $this->raw_css = $css_document; $this->rewriteSiteURLsToPlaceholder(); $css_parser = new Sabberworm\CSS\Parser( $this->raw_css ); $this->css_doc = $css_parser->parse(); require_once dirname( __FILE__ ) . '/../URL2/URL2.php'; $this->page_url = new Net_URL2( $page_url ); $this->detectIfURLsShouldBeHarvested(); $this->discovered_urls = array(); foreach ( $this->css_doc->getAllValues() as $node_value ) { if ( $node_value instanceof Sabberworm\CSS\Value\URL ) { $original_link = $node_value->getURL(); $original_link = trim( trim( $original_link, "'" ), '"' ); $inline_img = strpos( $original_link, 'data:image' ); if ( $inline_img !== false ) { continue; } $this->addDiscoveredURL( $original_link ); if ( $this->isInternalLink( $original_link ) ) { if ( ! isset( $this->settings['rewrite_rules'] ) ) { $this->settings['rewrite_rules'] = ''; } $this->settings['rewrite_rules'] .= PHP_EOL . $this->placeholder_url . ',' . $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_url = str_replace( $rewrite_from, $rewrite_to, $original_link ); $rewritten_url = new Sabberworm\CSS\Value\CSSString( $rewritten_url ); $node_value->setURL( $rewritten_url ); } } } $this->writeDiscoveredURLs(); return true; } public function isInternalLink( $link, $domain = false ) { if ( ! $domain ) { $domain = $this->placeholder_url; } $is_internal_link = parse_url( $link, PHP_URL_HOST ) === parse_url( $domain, PHP_URL_HOST ); return $is_internal_link; } public function getCSS() { return $this->css_doc->render(); } public function rewriteSiteURLsToPlaceholder() { $rewritten_source = str_replace( array( $this->settings['wp_site_url'], addcslashes( $this->settings['wp_site_url'], '/' ), ), array( $this->placeholder_url, addcslashes( $this->placeholder_url, '/' ), ), $this->raw_css ); $this->raw_css = $rewritten_source; } public function detectIfURLsShouldBeHarvested() { if ( defined( 'WP_CLI' ) ) { if ( defined( 'CRAWLING_DISCOVERED' ) ) { return; } else { $this->harvest_new_urls = true; } } else { $this->harvest_new_urls = ( $_POST['ajax_action'] === 'crawl_site' ); } } public function addDiscoveredURL( $url ) { $url = strtok( $url, '#' ); $url = strtok( $url, '?' ); if ( trim( $url ) === '' ) { return; } if ( isset( $this->harvest_new_urls ) ) { if ( ! $this->isValidURL( $url ) ) { return; } if ( $this->isInternalLink( $url ) ) { $discovered_url_without_site_url = str_replace( rtrim( $this->placeholder_url, '/' ), '', $url ); $this->discovered_urls[] = $discovered_url_without_site_url; } } } public function writeDiscoveredURLs() { if ( isset( $_POST['ajax_action'] ) && $_POST['ajax_action'] === 'crawl_again' ) { return; } if ( defined( 'WP_CLI' ) ) { if ( defined( 'CRAWLING_DISCOVERED' ) ) { return; } } file_put_contents( $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS.txt', PHP_EOL . implode( PHP_EOL, array_unique( $this->discovered_urls ) ), FILE_APPEND | LOCK_EX ); chmod( $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS.txt', 0664 ); } public function isValidURL( $url ) { $url = trim( $url ); if ( $url == '' ) { return false; } if ( strpos( $url, '.php' ) !== false ) { return false; } if ( strpos( $url, ' ' ) !== false ) { return false; } if ( $url[0] == '#' ) { return false; } return true; } public function getTargetSiteProtocol( $url ) { $protocol = '//'; if ( strpos( $url, 'https://' ) !== false ) { $protocol = 'https://'; } elseif ( strpos( $url, 'http://' ) !== false ) { $protocol = 'http://'; } else { $protocol = '//'; } return $protocol; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/DBSettings.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/DBSettings.php deleted file mode 100644 index c169c77..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/DBSettings.php +++ /dev/null @@ -1,2 +0,0 @@ -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 ); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Deployer.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Deployer.php deleted file mode 100644 index 3ca0799..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Deployer.php +++ /dev/null @@ -1,2 +0,0 @@ -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 ); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Dispatcher.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Dispatcher.php deleted file mode 100644 index 3751b5f..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Dispatcher.php +++ /dev/null @@ -1,2 +0,0 @@ -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 ); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FileCopier.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FileCopier.php deleted file mode 100644 index 0526636..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FileCopier.php +++ /dev/null @@ -1,2 +0,0 @@ -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)' ); } } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FileWriter.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FileWriter.php deleted file mode 100644 index eb713f0..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FileWriter.php +++ /dev/null @@ -1,2 +0,0 @@ -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 ); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FilesHelper.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FilesHelper.php deleted file mode 100644 index 189cdec..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/FilesHelper.php +++ /dev/null @@ -1,14 +0,0 @@ -parent_theme_path; $template_url = get_template_directory_uri(); } else { $template_path = $wp_site->child_theme_path; $template_url = get_stylesheet_directory_uri(); } $directory = $template_path; if ( is_dir( $directory ) ) { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $directory, RecursiveDirectoryIterator::SKIP_DOTS ) ); foreach ( $iterator as $filename => $file_object ) { $path_crawlable = self::filePathLooksCrawlable( $filename ); $detected_filename = str_replace( $template_path, $template_url, $filename ); $detected_filename = str_replace( get_home_url(), '', $detected_filename ); if ( $path_crawlable ) { array_push( $files, $detected_filename ); } } } return $files; } public static function detectVendorFiles( $wp_site_url ) { require_once dirname( __FILE__ ) . '/WPSite.php'; $wp_site = new WPSite(); $vendor_files = array(); if ( class_exists( '\\Elementor\Api' ) ) { $elementor_font_dir = WP_PLUGIN_DIR . '/elementor/assets/lib/font-awesome'; $elementor_urls = self::getListOfLocalFilesByUrl( $elementor_font_dir ); $vendor_files = array_merge( $vendor_files, $elementor_urls ); } if ( defined( 'WPSEO_VERSION' ) ) { $yoast_sitemaps = array( '/sitemap_index.xml', '/post-sitemap.xml', '/page-sitemap.xml', '/category-sitemap.xml', '/author-sitemap.xml', ); $vendor_files = array_merge( $vendor_files, $yoast_sitemaps ); } if ( is_dir( WP_PLUGIN_DIR . '/soliloquy/' ) ) { $soliloquy_assets = WP_PLUGIN_DIR . '/soliloquy/assets/css/images/'; $soliloquy_urls = self::getListOfLocalFilesByUrl( $soliloquy_assets ); $vendor_files = array_merge( $vendor_files, $soliloquy_urls ); } if ( class_exists( 'autoptimizeMain' ) ) { $autoptimize_cache_dir = $wp_site->wp_content_path . '/cache/autoptimize'; $prefix = str_replace( $wp_site->site_url, '/', $wp_site->wp_content_url ); $autoptimize_urls = self::getAutoptimizeCacheFiles( $autoptimize_cache_dir, $wp_site->wp_content_path, $prefix ); $vendor_files = array_merge( $vendor_files, $autoptimize_urls ); } if ( class_exists( 'Custom_Permalinks' ) ) { global $wpdb; $query = " - SELECT meta_value - FROM %s - WHERE meta_key = '%s' - "; $custom_permalinks = array(); $posts = $wpdb->get_results( sprintf( $query, $wpdb->postmeta, 'custom_permalink' ) ); if ( $posts ) { foreach ( $posts as $post ) { $custom_permalinks[] = $wp_site_url . $post->meta_value; } $vendor_files = array_merge( $vendor_files, $custom_permalinks ); } } if ( class_exists( 'molongui_authorship' ) ) { $molongui_path = WP_PLUGIN_DIR . '/molongui-authorship'; $molongui_urls = self::getListOfLocalFilesByUrl( $molongui_path ); $vendor_files = array_merge( $vendor_files, $molongui_urls ); } return $vendor_files; } public static function recursively_scan_dir( $dir, $siteroot, $list_path ) { $dir = str_replace( '//', '/', $dir ); $files = scandir( $dir ); foreach ( $files as $item ) { if ( $item != '.' && $item != '..' && $item != '.git' ) { if ( is_dir( $dir . '/' . $item ) ) { self::recursively_scan_dir( $dir . '/' . $item, $siteroot, $list_path ); } elseif ( is_file( $dir . '/' . $item ) ) { $subdir = str_replace( '/wp-admin/admin-ajax.php', '', $_SERVER['REQUEST_URI'] ); $subdir = ltrim( $subdir, '/' ); $clean_dir = str_replace( $siteroot . '/', '', $dir . '/' ); $clean_dir = str_replace( $subdir, '', $clean_dir ); $filename = $dir . '/' . $item . "\n"; $filename = str_replace( '//', '/', $filename ); file_put_contents( $list_path, $filename, FILE_APPEND | LOCK_EX ); chmod( $list_path, 0664 ); } } } } public static function getAutoptimizeCacheFiles( $cache_dir, $path_to_trim, $prefix ) { $files = array(); $directory = $cache_dir; if ( is_dir( $directory ) ) { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $directory, RecursiveDirectoryIterator::SKIP_DOTS ) ); foreach ( $iterator as $filename => $file_object ) { $path_crawlable = self::filePathLooksCrawlable( $filename ); if ( $path_crawlable ) { array_push( $files, $prefix . home_url( str_replace( $path_to_trim, '', $filename ) ) ); } } } return $files; } public static function getListOfLocalFilesByUrl( $url ) { $files = array(); $directory = str_replace( home_url( '/' ), ABSPATH, $url ); if ( is_dir( $directory ) ) { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $directory, RecursiveDirectoryIterator::SKIP_DOTS ) ); foreach ( $iterator as $filename => $file_object ) { $path_crawlable = self::filePathLooksCrawlable( $filename ); if ( $path_crawlable ) { array_push( $files, home_url( str_replace( ABSPATH, '', $filename ) ) ); } } } return $files; } public static function filePathLooksCrawlable( $file_name ) { $path_info = pathinfo( $file_name ); if ( ! is_file( $file_name ) ) { return false; } $filenames_to_ignore = array( '.DS_Store', '.PHP', '.SQL', '.git', '.idea', '.ini', '.map', '.php', '.sql', '.yarn', 'WP-STATIC', '__MACOSX', 'backwpup', 'bower.json', 'bower_components', 'composer.json', 'current-export', 'gulpfile.js', 'latest-export', 'node_modules', 'package.json', 'pb_backupbuddy', 'previous-export', 'thumbs.db', 'vendor', 'wp-static-html-output', ); foreach ( $filenames_to_ignore as $ignorable ) { if ( strpos( $file_name, $ignorable ) !== false ) { return false; } } if ( $path_info['basename'][0] === '.' ) { return false; } if ( ! isset( $path_info['extension'] ) ) { return false; } $extensions_to_ignore = array( 'php', 'phtml', 'tpl', 'less', 'scss', 'po', 'mo', 'tar.gz', 'zip', 'txt', 'po', 'pot', 'sh', 'sh', 'mo', 'md', ); if ( in_array( $path_info['extension'], $extensions_to_ignore ) ) { return false; } return true; } public static function buildInitialFileList( $via_cli = false, $uploads_path, $uploads_url, $settings ) { require_once dirname( __FILE__ ) . '/WPSite.php'; $wp_site = new WPSite(); $base_url = untrailingslashit( home_url() ); $url_queue = array_merge( array( trailingslashit( $base_url ) ), array( '/robots.txt' ), array( '/favicon.ico' ), array( '/sitemap.xml' ) ); switch ( $settings['detection_level'] ) { case 'homepage': break; case 'posts_and_pages': $url_queue = array_merge( $url_queue, self::getAllWPPostURLs( $base_url ) ); break; case 'everything': default: $url_queue = array_merge( $url_queue, self::getThemeFiles( 'parent' ), self::getThemeFiles( 'child' ), self::detectVendorFiles( $wp_site->site_url ), self::getListOfLocalFilesByUrl( $uploads_url ), self::getAllWPPostURLs( $base_url ) ); } $url_queue = self::cleanDetectedURLs( $url_queue ); $url_queue = apply_filters( 'wp2static_modify_initial_crawl_list', $url_queue ); $unique_urls = array_unique( $url_queue ); sort( $unique_urls ); $initial_crawl_list_total = count( $unique_urls ); $str = implode( "\n", $unique_urls ); file_put_contents( $uploads_path . '/WP-STATIC-INITIAL-CRAWL-LIST.txt', $str ); chmod( $uploads_path . '/WP-STATIC-INITIAL-CRAWL-LIST.txt', 0664 ); file_put_contents( $uploads_path . '/WP-STATIC-INITIAL-CRAWL-TOTAL.txt', $initial_crawl_list_total ); chmod( $uploads_path . '/WP-STATIC-INITIAL-CRAWL-TOTAL.txt', 0664 ); return count( $url_queue ); } public static function getAllWPPostURLs( $wp_site_url ) { global $wpdb; $post_urls = array(); $unique_post_types = array(); $query = " - SELECT ID,post_type - FROM %s - WHERE post_status = '%s' - AND post_type NOT IN ('%s','%s')"; $posts = $wpdb->get_results( sprintf( $query, $wpdb->posts, 'publish', 'revision', 'nav_menu_item' ) ); foreach ( $posts as $post ) { $unique_post_types[] = $post->post_type; switch ( $post->post_type ) { case 'page': $permalink = get_page_link( $post->ID ); break; case 'post': $permalink = get_permalink( $post->ID ); break; case 'attachment': $permalink = get_attachment_link( $post->ID ); break; default: $permalink = get_post_permalink( $post->ID ); break; } if ( strpos( $permalink, '?post_type' ) !== false ) { continue; } $post_urls[] = $permalink; $parsed_link = parse_url( $permalink ); $link_host = $wp_site_url . '/'; $link_path = $parsed_link['path']; $path_segments = explode( '/', $link_path ); array_shift( $path_segments ); array_pop( $path_segments ); $number_of_segments = count( $path_segments ); for ( $i = 0; $i < $number_of_segments; $i++ ) { $full_url = $link_host; for ( $x = 0; $x <= $i; $x++ ) { $full_url .= $path_segments[ $x ] . '/'; } $post_urls[] = $full_url; } } $args = array( 'public' => true, ); $taxonomies = get_taxonomies( $args, 'objects' ); $category_links = array(); foreach ( $taxonomies as $taxonomy ) { $terms = get_terms( $taxonomy->name, array( 'hide_empty' => true, ) ); foreach ( $terms as $term ) { $permalink = trim( get_term_link( $term ) ); $total_posts = $term->count; $term_url = str_replace( $wp_site_url, '', $permalink ); $category_links[ $term_url ] = $total_posts; $post_urls[] = $permalink; } } $category_pagination_urls = self::getPaginationURLsForCategories( $category_links ); $post_pagination_urls = self::getPaginationURLsForPosts( array_unique( $unique_post_types ) ); $comment_pagination_urls = self::getPaginationURLsForComments( $wp_site_url ); $post_urls = array_merge( $post_urls, $post_pagination_urls, $category_pagination_urls, $comment_pagination_urls ); return $post_urls; } public static function cleanDetectedURLs( $urls ) { $unique_urls = array_unique( $urls ); $wp_site_url = get_home_url(); $search_text = ' '; $url_queue = array_filter( $unique_urls, 'filter_arr_empty_vals' ); $stripped_urls = str_replace( $wp_site_url, '/', $url_queue ); $cleaned_urls = str_replace( '//', '/', $stripped_urls ); return $cleaned_urls; } public static function getPaginationURLsForPosts( $post_types ) { global $wpdb, $wp_rewrite; $pagination_base = $wp_rewrite->pagination_base; $default_posts_per_page = get_option( 'posts_per_page' ); $urls_to_include = array(); foreach ( $post_types as $post_type ) { $query = " - SELECT ID,post_type - FROM %s - WHERE post_status = '%s' - AND post_type = '%s'"; $count = $wpdb->get_results( sprintf( $query, $wpdb->posts, 'publish', $post_type ) ); $post_type_obj = get_post_type_object( $post_type ); $plural_form = strtolower( $post_type_obj->labels->name ); $count = $wpdb->num_rows; $total_pages = ceil( $count / $default_posts_per_page ); for ( $page = 1; $page <= $total_pages; $page++ ) { $pagination_url = "/{$plural_form}/{$pagination_base}/{$page}"; $urls_to_include[] = str_replace( '/posts/', '/', $pagination_url ); } } return $urls_to_include; } public static function getPaginationURLsForCategories( $categories ) { global $wp_rewrite; $urls_to_include = array(); $pagination_base = $wp_rewrite->pagination_base; $default_posts_per_page = get_option( 'posts_per_page' ); foreach ( $categories as $term => $total_posts ) { $total_pages = ceil( $total_posts / $default_posts_per_page ); for ( $page = 1; $page <= $total_pages; $page++ ) { $urls_to_include[] = "{$term}/{$pagination_base}/{$page}"; } } return $urls_to_include; } public static function getPaginationURLsForComments( $wp_site_url ) { global $wp_rewrite; $urls_to_include = array(); $comments_pagination_base = $wp_rewrite->comments_pagination_base; foreach ( get_comments() as $comment ) { $comment_url = get_comment_link( $comment->comment_ID ); $comment_url = strtok( $comment_url, '#' ); $urls_to_include[] = str_replace( $wp_site_url, '', $comment_url ); } return array_unique( $urls_to_include ); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/HTMLProcessor.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/HTMLProcessor.php deleted file mode 100644 index 889f51f..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/HTMLProcessor.php +++ /dev/null @@ -1,2 +0,0 @@ -loadSettings( array( 'github', 'wpenv', 'processing', 'advanced', ) ); $this->processed_urls = array(); } public function processHTML( $html_document, $page_url ) { if ( $html_document == '' ) { return false; } $this->xml_doc = new DOMDocument(); $this->destination_protocol = $this->getTargetSiteProtocol( $this->settings['baseUrl'] ); $this->placeholder_url = $this->destination_protocol . 'PLACEHOLDER.wpsho/'; $this->raw_html = $this->rewriteSiteURLsToPlaceholder( $html_document ); $this->base_tag_exists = false; require_once dirname( __FILE__ ) . '/../URL2/URL2.php'; $this->page_url = new Net_url2( $page_url ); $this->detectIfURLsShouldBeHarvested(); $this->discovered_urls = array(); libxml_use_internal_errors( true ); $this->xml_doc->loadHTML( $this->raw_html ); libxml_use_internal_errors( false ); $elements = iterator_to_array( $this->xml_doc->getElementsByTagName( '*' ) ); foreach ( $elements as $element ) { switch ( $element->tagName ) { case 'meta': $this->processMeta( $element ); break; case 'a': $this->processAnchor( $element ); break; case 'img': $this->processImage( $element ); $this->processImageSrcSet( $element ); break; case 'head': $this->processHead( $element ); break; case 'link': $this->processLink( $element ); break; case 'script': $this->processScript( $element ); break; } } if ( $this->base_tag_exists ) { $base_element = $this->xml_doc->getElementsByTagName( 'base' )->item( 0 ); if ( $this->shouldCreateBaseHREF() ) { $base_element->setAttribute( 'href', $this->settings['baseHREF'] ); } else { $base_element->parentNode->removeChild( $base_element ); } } elseif ( $this->shouldCreateBaseHREF() ) { $base_element = $this->xml_doc->createElement( 'base' ); $base_element->setAttribute( 'href', $this->settings['baseHREF'] ); $head_element = $this->xml_doc->getElementsByTagName( 'head' )->item( 0 ); if ( $head_element ) { $first_head_child = $head_element->firstChild; $head_element->insertBefore( $base_element, $first_head_child ); } else { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'WARNING: no valid head elemnent to attach base to: ' . $this->page_url ); } } $this->stripHTMLComments(); $this->writeDiscoveredURLs(); return true; } public function detectIfURLsShouldBeHarvested() { if ( ! defined( 'WP_CLI' ) ) { $this->harvest_new_urls = ( $_POST['ajax_action'] === 'crawl_site' ); } else { if ( defined( 'CRAWLING_DISCOVERED' ) ) { return; } else { $this->harvest_new_urls = true; } } } public function processLink( $element ) { $this->normalizeURL( $element, 'href' ); $this->removeQueryStringFromInternalLink( $element ); $this->addDiscoveredURL( $element->getAttribute( 'href' ) ); $this->rewriteWPPaths( $element ); $this->rewriteBaseURL( $element ); $this->convertToRelativeURL( $element ); $this->convertToOfflineURL( $element ); if ( isset( $this->settings['removeWPLinks'] ) ) { $relative_links_to_rm = array( 'shortlink', 'canonical', 'pingback', 'alternate', 'EditURI', 'wlwmanifest', 'index', 'profile', 'prev', 'next', 'wlwmanifest', ); $link_rel = $element->getAttribute( 'rel' ); if ( in_array( $link_rel, $relative_links_to_rm ) ) { $element->parentNode->removeChild( $element ); } elseif ( strpos( $link_rel, '.w.org' ) !== false ) { $element->parentNode->removeChild( $element ); } } } public function isValidURL( $url ) { $url = trim( $url ); if ( $url == '' ) { return false; } if ( strpos( $url, '.php' ) !== false ) { return false; } if ( strpos( $url, ' ' ) !== false ) { return false; } if ( $url[0] == '#' ) { return false; } return true; } public function addDiscoveredURL( $url ) { $url = strtok( $url, '#' ); $url = strtok( $url, '?' ); if ( in_array( $url, $this->processed_urls ) ) { return; } if ( trim( $url ) === '' ) { return; } $this->processed_urls[] = $url; if ( isset( $this->harvest_new_urls ) ) { if ( ! $this->isValidURL( $url ) ) { return; } if ( $this->isInternalLink( $url ) ) { $discovered_url_without_site_url = str_replace( rtrim( $this->placeholder_url, '/' ), '', $url ); $this->logAction( 'Adding discovered URL: ' . $discovered_url_without_site_url ); $this->discovered_urls[] = $discovered_url_without_site_url; } } } public function processImageSrcSet( $element ) { if ( ! $element->hasAttribute( 'srcset' ) ) { return; } $new_src_set = array(); $src_set = $element->getAttribute( 'srcset' ); $src_set_lines = explode( ',', $src_set ); foreach ( $src_set_lines as $src_set_line ) { $all_pieces = explode( ' ', $src_set_line ); $pieces = array_filter( $all_pieces ); $pieces = array_values( $pieces ); $url = $pieces[0]; $dimension = $pieces[1]; if ( $this->isInternalLink( $url ) ) { $url = $this->page_url->resolve( $url ); $url = strtok( $url, '?' ); $this->addDiscoveredURL( $url ); $url = $this->rewriteWPPathsSrcSetURL( $url ); $url = $this->rewriteBaseURLSrcSetURL( $url ); $url = $this->convertToRelativeURLSrcSetURL( $url ); $url = $this->convertToOfflineURLSrcSetURL( $url ); } $new_src_set[] = "{$url} {$dimension}"; } $element->setAttribute( 'srcset', implode( ',', $new_src_set ) ); } public function processImage( $element ) { $this->normalizeURL( $element, 'src' ); $this->removeQueryStringFromInternalLink( $element ); $this->addDiscoveredURL( $element->getAttribute( 'src' ) ); $this->rewriteWPPaths( $element ); $this->rewriteBaseURL( $element ); $this->convertToRelativeURL( $element ); $this->convertToOfflineURL( $element ); } public function stripHTMLComments() { if ( isset( $this->settings['removeHTMLComments'] ) ) { $xpath = new DOMXPath( $this->xml_doc ); foreach ( $xpath->query( '//comment()' ) as $comment ) { $comment->parentNode->removeChild( $comment ); } } } public function processHead( $element ) { $head_elements = iterator_to_array( $element->childNodes ); foreach ( $head_elements as $node ) { if ( $node instanceof DOMComment ) { if ( isset( $this->settings['removeConditionalHeadComments'] ) ) { $node->parentNode->removeChild( $node ); } } elseif ( isset( $node->tagName ) ) { if ( $node->tagName === 'base' ) { $this->base_tag_exists = true; } } } } public function processScript( $element ) { $this->normalizeURL( $element, 'src' ); $this->removeQueryStringFromInternalLink( $element ); $this->addDiscoveredURL( $element->getAttribute( 'src' ) ); $this->rewriteWPPaths( $element ); $this->rewriteBaseURL( $element ); $this->convertToRelativeURL( $element ); $this->convertToOfflineURL( $element ); } public function processAnchor( $element ) { $url = $element->getAttribute( 'href' ); if ( $url[0] === '#' ) { return; } if ( substr( $url, 0, 7 ) == 'mailto:' ) { return; } if ( ! $this->isInternalLink( $url ) ) { return; } $this->normalizeURL( $element, 'href' ); $this->removeQueryStringFromInternalLink( $element ); $this->addDiscoveredURL( $url ); $this->rewriteWPPaths( $element ); $this->rewriteBaseURL( $element ); $this->convertToRelativeURL( $element ); $this->convertToOfflineURL( $element ); } public function processMeta( $element ) { if ( isset( $this->settings['removeWPMeta'] ) ) { $meta_name = $element->getAttribute( 'name' ); if ( strpos( $meta_name, 'generator' ) !== false ) { $element->parentNode->removeChild( $element ); return; } if ( strpos( $meta_name, 'robots' ) !== false ) { $content = $element->getAttribute( 'content' ); if ( strpos( $content, 'noindex' ) !== false ) { $element->parentNode->removeChild( $element ); } } } $url = $element->getAttribute( 'content' ); $this->normalizeURL( $element, 'content' ); $this->removeQueryStringFromInternalLink( $element ); $this->addDiscoveredURL( $url ); $this->rewriteWPPaths( $element ); $this->rewriteBaseURL( $element ); $this->convertToRelativeURL( $element ); $this->convertToOfflineURL( $element ); } public function writeDiscoveredURLs() { if ( isset( $_POST['ajax_action'] ) && $_POST['ajax_action'] === 'crawl_again' ) { return; } if ( defined( 'WP_CLI' ) ) { if ( defined( 'CRAWLING_DISCOVERED' ) ) { return; } } file_put_contents( $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS.txt', PHP_EOL . implode( PHP_EOL, array_unique( $this->discovered_urls ) ), FILE_APPEND | LOCK_EX ); chmod( $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS.txt', 0664 ); } public function normalizeURL( $element, $attribute ) { $original_link = $element->getAttribute( $attribute ); if ( $this->isInternalLink( $original_link ) ) { $abs = $this->page_url->resolve( $original_link ); $element->setAttribute( $attribute, $abs ); } } public function isInternalLink( $link, $domain = false ) { if ( ! $domain ) { $domain = $this->placeholder_url; } $is_internal_link = parse_url( $link, PHP_URL_HOST ) === parse_url( $domain, PHP_URL_HOST ); return $is_internal_link; } public function removeQueryStringFromInternalLink( $element ) { $attribute_to_change = ''; $url_to_change = ''; if ( $element->hasAttribute( 'href' ) ) { $attribute_to_change = 'href'; } elseif ( $element->hasAttribute( 'src' ) ) { $attribute_to_change = 'src'; } elseif ( $element->hasAttribute( 'content' ) ) { $attribute_to_change = 'content'; } else { return; } $url_to_change = $element->getAttribute( $attribute_to_change ); if ( $this->isInternalLink( $url_to_change ) ) { $element->setAttribute( $attribute_to_change, strtok( $url_to_change, '?' ) ); } } public function detectEscapedSiteURLs( $processed_html ) { $escaped_site_url = addcslashes( $this->placeholder_url, '/' ); if ( strpos( $processed_html, $escaped_site_url ) !== false ) { return $this->rewriteEscapedURLs( $processed_html ); } return $processed_html; } public function detectUnchangedPlaceholderURLs( $processed_html ) { $placeholder_url = $this->placeholder_url; if ( strpos( $processed_html, $placeholder_url ) !== false ) { return $this->rewriteUnchangedPlaceholderURLs( $processed_html ); } return $processed_html; } public function rewriteUnchangedPlaceholderURLs( $processed_html ) { if ( ! isset( $this->settings['rewrite_rules'] ) ) { $this->settings['rewrite_rules'] = ''; } $placeholder_url = rtrim( $this->placeholder_url, '/' ); $destination_url = rtrim( $this->settings['baseUrl'], '/' ); $this->settings['rewrite_rules'] .= PHP_EOL . $placeholder_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[] = $from; $rewrite_to[] = $to; } } $rewritten_source = str_replace( $rewrite_from, $rewrite_to, $processed_html ); return $rewritten_source; } public function rewriteEscapedURLs( $processed_html ) { $processed_html = str_replace( '%5C/', '\\/', $processed_html ); $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_html ); return $rewritten_source; } public function rewriteWPPathsSrcSetURL( $url_to_change ) { if ( ! isset( $this->settings['rewrite_rules'] ) ) { return $url_to_change; } $rewrite_from = array(); $rewrite_to = array(); $rewrite_rules = explode( "\n", str_replace( "\r", '', $this->settings['rewrite_rules'] ) ); foreach ( $rewrite_rules as $rewrite_rule_line ) { list($from, $to) = explode( ',', $rewrite_rule_line ); $rewrite_from[] = $from; $rewrite_to[] = $to; } $rewritten_url = str_replace( $rewrite_from, $rewrite_to, $url_to_change ); return $rewritten_url; } public function rewriteWPPaths( $element ) { if ( ! isset( $this->settings['rewrite_rules'] ) ) { return; } $rewrite_from = array(); $rewrite_to = array(); $rewrite_rules = explode( "\n", str_replace( "\r", '', $this->settings['rewrite_rules'] ) ); foreach ( $rewrite_rules as $rewrite_rule_line ) { list($from, $to) = explode( ',', $rewrite_rule_line ); $rewrite_from[] = $from; $rewrite_to[] = $to; } $attribute_to_change = ''; $url_to_change = ''; if ( $element->hasAttribute( 'href' ) ) { $attribute_to_change = 'href'; } elseif ( $element->hasAttribute( 'src' ) ) { $attribute_to_change = 'src'; } elseif ( $element->hasAttribute( 'content' ) ) { $attribute_to_change = 'content'; } else { return; } $url_to_change = $element->getAttribute( $attribute_to_change ); if ( $this->isInternalLink( $url_to_change ) ) { $rewritten_url = str_replace( $rewrite_from, $rewrite_to, $url_to_change ); $element->setAttribute( $attribute_to_change, $rewritten_url ); } } public function getHTML() { $processed_html = $this->xml_doc->saveHtml(); $processed_html = $this->detectEscapedSiteURLs( $processed_html ); $processed_html = $this->detectUnchangedPlaceholderURLs( $processed_html ); $processed_html = html_entity_decode( $processed_html, ENT_QUOTES, 'UTF-8' ); $processed_html = html_entity_decode( $processed_html, ENT_QUOTES, 'UTF-8' ); return $processed_html; } public function convertToRelativeURLSrcSetURL( $url_to_change ) { if ( ! $this->shouldUseRelativeURLs() ) { return $url_to_change; } $site_root = ''; $relative_url = str_replace( $this->settings['baseUrl'], $site_root, $url_to_change ); return $relative_url; } public function convertToRelativeURL( $element ) { if ( ! $this->shouldUseRelativeURLs() ) { return; } if ( $element->hasAttribute( 'href' ) ) { $attribute_to_change = 'href'; } elseif ( $element->hasAttribute( 'src' ) ) { $attribute_to_change = 'src'; } elseif ( $element->hasAttribute( 'content' ) ) { $attribute_to_change = 'content'; } else { return; } $url_to_change = $element->getAttribute( $attribute_to_change ); $site_root = ''; if ( $this->isInternalLink( $url_to_change, $this->settings['baseUrl'] ) ) { $rewritten_url = str_replace( $this->settings['baseUrl'], $site_root, $url_to_change ); $element->setAttribute( $attribute_to_change, $rewritten_url ); } } public function convertToOfflineURLSrcSetURL( $url_to_change ) { if ( ! $this->shouldCreateOfflineURLs() ) { return $url_to_change; } $current_page_path_to_root = ''; $current_page_path = parse_url( $this->page_url, PHP_URL_PATH ); $number_of_segments_in_path = explode( '/', $current_page_path ); $num_dots_to_root = count( $number_of_segments_in_path ) - 2; for ( $i = 0; $i < $num_dots_to_root; $i++ ) { $current_page_path_to_root .= '../'; } if ( ! $this->isInternalLink( $url_to_change ) ) { return false; } $rewritten_url = str_replace( $this->placeholder_url, '', $url_to_change ); $offline_url = $current_page_path_to_root . $rewritten_url; if ( substr( $offline_url, -1 ) === '/' ) { $offline_url .= 'index.html'; } return $offline_url; } public function convertToOfflineURL( $element ) { if ( ! $this->shouldCreateOfflineURLs() ) { return; } if ( $element->hasAttribute( 'href' ) ) { $attribute_to_change = 'href'; } elseif ( $element->hasAttribute( 'src' ) ) { $attribute_to_change = 'src'; } elseif ( $element->hasAttribute( 'content' ) ) { $attribute_to_change = 'content'; } else { return; } $url_to_change = $element->getAttribute( $attribute_to_change ); $current_page_path_to_root = ''; $current_page_path = parse_url( $this->page_url, PHP_URL_PATH ); $number_of_segments_in_path = explode( '/', $current_page_path ); $num_dots_to_root = count( $number_of_segments_in_path ) - 2; for ( $i = 0; $i < $num_dots_to_root; $i++ ) { $current_page_path_to_root .= '../'; } if ( ! $this->isInternalLink( $url_to_change ) ) { return false; } $rewritten_url = str_replace( $this->placeholder_url, '', $url_to_change ); $offline_url = $current_page_path_to_root . $rewritten_url; if ( substr( $offline_url, -1 ) === '/' ) { $offline_url .= 'index.html'; } $element->setAttribute( $attribute_to_change, $offline_url ); } public function getProtocolRelativeURL( $url ) { $this->destination_protocol_relative_url = str_replace( array( 'https:', 'http:', ), array( '', '', ), $url ); return $this->destination_protocol_relative_url; } public function rewriteBaseURLSrcSetURL( $url_to_change ) { $rewritten_url = str_replace( $this->getBaseURLRewritePatterns(), $this->getBaseURLRewritePatterns(), $url_to_change ); return $rewritten_url; } public function rewriteBaseURL( $element ) { if ( $element->hasAttribute( 'href' ) ) { $attribute_to_change = 'href'; } elseif ( $element->hasAttribute( 'src' ) ) { $attribute_to_change = 'src'; } elseif ( $element->hasAttribute( 'content' ) ) { $attribute_to_change = 'content'; } else { return; } $url_to_change = $element->getAttribute( $attribute_to_change ); if ( $this->isInternalLink( $url_to_change ) ) { $rewritten_url = str_replace( $this->getBaseURLRewritePatterns(), $this->getBaseURLRewritePatterns(), $url_to_change ); $element->setAttribute( $attribute_to_change, $rewritten_url ); } } public function getTargetSiteProtocol( $url ) { $this->destination_protocol = '//'; if ( strpos( $url, 'https://' ) !== false ) { $this->destination_protocol = 'https://'; } elseif ( strpos( $url, 'http://' ) !== false ) { $this->destination_protocol = 'http://'; } else { $this->destination_protocol = '//'; } return $this->destination_protocol; } public function rewriteSiteURLsToPlaceholder( $raw_html ) { $site_url = rtrim( $this->settings['wp_site_url'], '/' ); $placeholder_url = rtrim( $this->placeholder_url, '/' ); $patterns = array( $site_url, addcslashes( $site_url, '/' ), $this->getProtocolRelativeURL( $site_url ), $this->getProtocolRelativeURL( $site_url . '//' ), $this->getProtocolRelativeURL( addcslashes( $site_url, '/' ) ), ); $replacements = array( $placeholder_url, addcslashes( $placeholder_url, '/' ), $this->getProtocolRelativeURL( $placeholder_url ), $this->getProtocolRelativeURL( $placeholder_url . '/' ), $this->getProtocolRelativeURL( addcslashes( $placeholder_url, '/' ) ), ); $rewritten_source = str_replace( $patterns, $replacements, $raw_html ); return $rewritten_source; } public function shouldUseRelativeURLs() { if ( ! isset( $this->settings['useRelativeURLs'] ) ) { return false; } if ( isset( $this->settings['allowOfflineUsage'] ) ) { return false; } } public function shouldCreateBaseHREF() { if ( empty( $this->settings['baseHREF'] ) ) { return false; } if ( isset( $this->settings['allowOfflineUsage'] ) ) { return false; } return true; } public function shouldCreateOfflineURLs() { if ( ! isset( $this->settings['allowOfflineUsage'] ) ) { return false; } if ( $this->settings['selected_deployment_option'] != 'zip' ) { return false; } return true; } public function getBaseURLRewritePatterns() { $patterns = array( $this->placeholder_url, addcslashes( $this->placeholder_url, '/' ), $this->getProtocolRelativeURL( $this->placeholder_url ), $this->getProtocolRelativeURL( $this->placeholder_url ), $this->getProtocolRelativeURL( $this->placeholder_url . '/' ), $this->getProtocolRelativeURL( addcslashes( $this->placeholder_url, '/' ) ), ); return $patterns; } public function getBaseURLRewriteReplacements() { $replacements = array( $this->settings['baseUrl'], addcslashes( $this->settings['baseUrl'], '/' ), $this->getProtocolRelativeURL( $this->settings['baseUrl'] ), $this->getProtocolRelativeURL( rtrim( $this->settings['baseUrl'], '/' ) ), $this->getProtocolRelativeURL( $this->settings['baseUrl'] . '//' ), $this->getProtocolRelativeURL( addcslashes( $this->settings['baseUrl'], '/' ) ), ); return $replacements; } public function logAction( $action ) { if ( ! isset( $this->settings['debug_mode'] ) ) { return; } require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( $action ); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/MimeTypes.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/MimeTypes.php deleted file mode 100644 index 1af8f0a..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/MimeTypes.php +++ /dev/null @@ -1,2 +0,0 @@ - 'application/vnd.lotus-1-2-3', '3dml' => 'text/vnd.in3d.3dml', '3ds' => 'image/x-3ds', '3g2' => 'video/3gpp2', '3gp' => 'video/3gpp', '7z' => 'application/x-7z-compressed', 'aab' => 'application/x-authorware-bin', 'aac' => 'audio/x-aac', 'aam' => 'application/x-authorware-map', 'aas' => 'application/x-authorware-seg', 'abw' => 'application/x-abiword', 'ac' => 'application/pkix-attr-cert', 'acc' => 'application/vnd.americandynamics.acc', 'ace' => 'application/x-ace-compressed', 'acu' => 'application/vnd.acucobol', 'acutc' => 'application/vnd.acucorp', 'adp' => 'audio/adpcm', 'aep' => 'application/vnd.audiograph', 'afm' => 'application/x-font-type1', 'afp' => 'application/vnd.ibm.modcap', 'ahead' => 'application/vnd.ahead.space', 'ai' => 'application/postscript', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'air' => 'application/vnd.adobe.air-application-installer-package+zip', 'ait' => 'application/vnd.dvb.ait', 'ami' => 'application/vnd.amiga.ami', 'apk' => 'application/vnd.android.package-archive', 'appcache' => 'text/cache-manifest', 'application' => 'application/x-ms-application', 'apr' => 'application/vnd.lotus-approach', 'arc' => 'application/x-freearc', 'asc' => 'application/pgp-signature', 'asf' => 'video/x-ms-asf', 'asm' => 'text/x-asm', 'aso' => 'application/vnd.accpac.simply.aso', 'asx' => 'video/x-ms-asf', 'atc' => 'application/vnd.acucorp', 'atom' => 'application/atom+xml', 'atomcat' => 'application/atomcat+xml', 'atomsvc' => 'application/atomsvc+xml', 'atx' => 'application/vnd.antix.game-component', 'au' => 'audio/basic', 'avi' => 'video/x-msvideo', 'aw' => 'application/applixware', 'azf' => 'application/vnd.airzip.filesecure.azf', 'azs' => 'application/vnd.airzip.filesecure.azs', 'azw' => 'application/vnd.amazon.ebook', 'bat' => 'application/x-msdownload', 'bcpio' => 'application/x-bcpio', 'bdf' => 'application/x-font-bdf', 'bdm' => 'application/vnd.syncml.dm+wbxml', 'bed' => 'application/vnd.realvnc.bed', 'bh2' => 'application/vnd.fujitsu.oasysprs', 'bin' => 'application/octet-stream', 'blb' => 'application/x-blorb', 'blorb' => 'application/x-blorb', 'bmi' => 'application/vnd.bmi', 'bmp' => 'image/bmp', 'book' => 'application/vnd.framemaker', 'box' => 'application/vnd.previewsystems.box', 'boz' => 'application/x-bzip2', 'bpk' => 'application/octet-stream', 'btif' => 'image/prs.btif', 'bz' => 'application/x-bzip', 'bz2' => 'application/x-bzip2', 'c' => 'text/x-c', 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', 'c4d' => 'application/vnd.clonk.c4group', 'c4f' => 'application/vnd.clonk.c4group', 'c4g' => 'application/vnd.clonk.c4group', 'c4p' => 'application/vnd.clonk.c4group', 'c4u' => 'application/vnd.clonk.c4group', 'cab' => 'application/vnd.ms-cab-compressed', 'caf' => 'audio/x-caf', 'cap' => 'application/vnd.tcpdump.pcap', 'car' => 'application/vnd.curl.car', 'cat' => 'application/vnd.ms-pki.seccat', 'cb7' => 'application/x-cbr', 'cba' => 'application/x-cbr', 'cbr' => 'application/x-cbr', 'cbt' => 'application/x-cbr', 'cbz' => 'application/x-cbr', 'cc' => 'text/x-c', 'cct' => 'application/x-director', 'ccxml' => 'application/ccxml+xml', 'cdbcmsg' => 'application/vnd.contact.cmsg', 'cdf' => 'application/x-netcdf', 'cdkey' => 'application/vnd.mediastation.cdkey', 'cdmia' => 'application/cdmi-capability', 'cdmic' => 'application/cdmi-container', 'cdmid' => 'application/cdmi-domain', 'cdmio' => 'application/cdmi-object', 'cdmiq' => 'application/cdmi-queue', 'cdx' => 'chemical/x-cdx', 'cdxml' => 'application/vnd.chemdraw+xml', 'cdy' => 'application/vnd.cinderella', 'cer' => 'application/pkix-cert', 'cfs' => 'application/x-cfs-compressed', 'cgm' => 'image/cgm', 'chat' => 'application/x-chat', 'chm' => 'application/vnd.ms-htmlhelp', 'chrt' => 'application/vnd.kde.kchart', 'cif' => 'chemical/x-cif', 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', 'cil' => 'application/vnd.ms-artgalry', 'cla' => 'application/vnd.claymore', 'class' => 'application/java-vm', 'clkk' => 'application/vnd.crick.clicker.keyboard', 'clkp' => 'application/vnd.crick.clicker.palette', 'clkt' => 'application/vnd.crick.clicker.template', 'clkw' => 'application/vnd.crick.clicker.wordbank', 'clkx' => 'application/vnd.crick.clicker', 'clp' => 'application/x-msclip', 'cmc' => 'application/vnd.cosmocaller', 'cmdf' => 'chemical/x-cmdf', 'cml' => 'chemical/x-cml', 'cmp' => 'application/vnd.yellowriver-custom-menu', 'cmx' => 'image/x-cmx', 'cod' => 'application/vnd.rim.cod', 'com' => 'application/x-msdownload', 'conf' => 'text/plain', 'cpio' => 'application/x-cpio', 'cpp' => 'text/x-c', 'cpt' => 'application/mac-compactpro', 'crd' => 'application/x-mscardfile', 'crl' => 'application/pkix-crl', 'crt' => 'application/x-x509-ca-cert', 'cryptonote' => 'application/vnd.rig.cryptonote', 'csh' => 'application/x-csh', 'csml' => 'chemical/x-csml', 'csp' => 'application/vnd.commonspace', 'css' => 'text/css', 'cst' => 'application/x-director', 'csv' => 'text/csv', 'cu' => 'application/cu-seeme', 'curl' => 'text/vnd.curl', 'cww' => 'application/prs.cww', 'cxt' => 'application/x-director', 'cxx' => 'text/x-c', 'dae' => 'model/vnd.collada+xml', 'daf' => 'application/vnd.mobius.daf', 'dart' => 'application/vnd.dart', 'dataless' => 'application/vnd.fdsn.seed', 'davmount' => 'application/davmount+xml', 'dbk' => 'application/docbook+xml', 'dcr' => 'application/x-director', 'dcurl' => 'text/vnd.curl.dcurl', 'dd2' => 'application/vnd.oma.dd2+xml', 'ddd' => 'application/vnd.fujixerox.ddd', 'deb' => 'application/x-debian-package', 'def' => 'text/plain', 'deploy' => 'application/octet-stream', 'der' => 'application/x-x509-ca-cert', 'dfac' => 'application/vnd.dreamfactory', 'dgc' => 'application/x-dgc-compressed', 'dic' => 'text/x-c', 'dir' => 'application/x-director', 'dis' => 'application/vnd.mobius.dis', 'dist' => 'application/octet-stream', 'distz' => 'application/octet-stream', 'djv' => 'image/vnd.djvu', 'djvu' => 'image/vnd.djvu', 'dll' => 'application/x-msdownload', 'dmg' => 'application/x-apple-diskimage', 'dmp' => 'application/vnd.tcpdump.pcap', 'dms' => 'application/octet-stream', 'dna' => 'application/vnd.dna', 'doc' => 'application/msword', 'docm' => 'application/vnd.ms-word.document.macroenabled.12', 'docx' => 'application/vnd.openxmlformats-officedocument.wordp' . 'rocessingml.document', 'dot' => 'application/msword', 'dotm' => 'application/vnd.ms-word.template.macroenabled.12', 'dotx' => 'application/vnd.openxmlformats-officedocument.wordp' . 'rocessingml.template', 'dp' => 'application/vnd.osgi.dp', 'dpg' => 'application/vnd.dpgraph', 'dra' => 'audio/vnd.dra', 'dsc' => 'text/prs.lines.tag', 'dssc' => 'application/dssc+der', 'dtb' => 'application/x-dtbook+xml', 'dtd' => 'application/xml-dtd', 'dts' => 'audio/vnd.dts', 'dtshd' => 'audio/vnd.dts.hd', 'dump' => 'application/octet-stream', 'dvb' => 'video/vnd.dvb.file', 'dvi' => 'application/x-dvi', 'dwf' => 'model/vnd.dwf', 'dwg' => 'image/vnd.dwg', 'dxf' => 'image/vnd.dxf', 'dxp' => 'application/vnd.spotfire.dxp', 'dxr' => 'application/x-director', 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', 'ecma' => 'application/ecmascript', 'edm' => 'application/vnd.novadigm.edm', 'edx' => 'application/vnd.novadigm.edx', 'efif' => 'application/vnd.picsel', 'ei6' => 'application/vnd.pg.osasli', 'elc' => 'application/octet-stream', 'emf' => 'application/x-msmetafile', 'eml' => 'message/rfc822', 'emma' => 'application/emma+xml', 'emz' => 'application/x-msmetafile', 'eol' => 'audio/vnd.digital-winds', 'eot' => 'application/vnd.ms-fontobject', 'eps' => 'application/postscript', 'epub' => 'application/epub+zip', 'es3' => 'application/vnd.eszigno3+xml', 'esa' => 'application/vnd.osgi.subsystem', 'esf' => 'application/vnd.epson.esf', 'et3' => 'application/vnd.eszigno3+xml', 'etx' => 'text/x-setext', 'eva' => 'application/x-eva', 'evy' => 'application/x-envoy', 'exe' => 'application/x-msdownload', 'exi' => 'application/exi', 'ext' => 'application/vnd.novadigm.ext', 'ez' => 'application/andrew-inset', 'ez2' => 'application/vnd.ezpix-album', 'ez3' => 'application/vnd.ezpix-package', 'f' => 'text/x-fortran', 'f4v' => 'video/x-f4v', 'f77' => 'text/x-fortran', 'f90' => 'text/x-fortran', 'fbs' => 'image/vnd.fastbidsheet', 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', 'fcs' => 'application/vnd.isac.fcs', 'fdf' => 'application/vnd.fdf', 'fe_launch' => 'application/vnd.denovo.fcselayout-link', 'fg5' => 'application/vnd.fujitsu.oasysgp', 'fgd' => 'application/x-director', 'fh' => 'image/x-freehand', 'fh4' => 'image/x-freehand', 'fh5' => 'image/x-freehand', 'fh7' => 'image/x-freehand', 'fhc' => 'image/x-freehand', 'fig' => 'application/x-xfig', 'flac' => 'audio/x-flac', 'fli' => 'video/x-fli', 'flo' => 'application/vnd.micrografx.flo', 'flv' => 'video/x-flv', 'flw' => 'application/vnd.kde.kivio', 'flx' => 'text/vnd.fmi.flexstor', 'fly' => 'text/vnd.fly', 'fm' => 'application/vnd.framemaker', 'fnc' => 'application/vnd.frogans.fnc', 'for' => 'text/x-fortran', 'fpx' => 'image/vnd.fpx', 'frame' => 'application/vnd.framemaker', 'fsc' => 'application/vnd.fsc.weblaunch', 'fst' => 'image/vnd.fst', 'ftc' => 'application/vnd.fluxtime.clip', 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', 'fvt' => 'video/vnd.fvt', 'fxp' => 'application/vnd.adobe.fxp', 'fxpl' => 'application/vnd.adobe.fxp', 'fzs' => 'application/vnd.fuzzysheet', 'g2w' => 'application/vnd.geoplan', 'g3' => 'image/g3fax', 'g3w' => 'application/vnd.geospace', 'gac' => 'application/vnd.groove-account', 'gam' => 'application/x-tads', 'gbr' => 'application/rpki-ghostbusters', 'gca' => 'application/x-gca-compressed', 'gdl' => 'model/vnd.gdl', 'geo' => 'application/vnd.dynageo', 'gex' => 'application/vnd.geometry-explorer', 'ggb' => 'application/vnd.geogebra.file', 'ggt' => 'application/vnd.geogebra.tool', 'ghf' => 'application/vnd.groove-help', 'gif' => 'image/gif', 'gim' => 'application/vnd.groove-identity-message', 'gml' => 'application/gml+xml', 'gmx' => 'application/vnd.gmx', 'gnumeric' => 'application/x-gnumeric', 'gph' => 'application/vnd.flographit', 'gpx' => 'application/gpx+xml', 'gqf' => 'application/vnd.grafeq', 'gqs' => 'application/vnd.grafeq', 'gram' => 'application/srgs', 'gramps' => 'application/x-gramps-xml', 'gre' => 'application/vnd.geometry-explorer', 'grv' => 'application/vnd.groove-injector', 'grxml' => 'application/srgs+xml', 'gsf' => 'application/x-font-ghostscript', 'gtar' => 'application/x-gtar', 'gtm' => 'application/vnd.groove-tool-message', 'gtw' => 'model/vnd.gtw', 'gv' => 'text/vnd.graphviz', 'gxf' => 'application/gxf', 'gxt' => 'application/vnd.geonext', 'h' => 'text/x-c', 'h261' => 'video/h261', 'h263' => 'video/h263', 'h264' => 'video/h264', 'hal' => 'application/vnd.hal+xml', 'hbci' => 'application/vnd.hbci', 'hdf' => 'application/x-hdf', 'hh' => 'text/x-c', 'hlp' => 'application/winhlp', 'hpgl' => 'application/vnd.hp-hpgl', 'hpid' => 'application/vnd.hp-hpid', 'hps' => 'application/vnd.hp-hps', 'hqx' => 'application/mac-binhex40', 'htke' => 'application/vnd.kenameaapp', 'htm' => 'text/html', 'html' => 'text/html', 'hvd' => 'application/vnd.yamaha.hv-dic', 'hvp' => 'application/vnd.yamaha.hv-voice', 'hvs' => 'application/vnd.yamaha.hv-script', 'i2g' => 'application/vnd.intergeo', 'icc' => 'application/vnd.iccprofile', 'ice' => 'x-conference/x-cooltalk', 'icm' => 'application/vnd.iccprofile', 'ico' => 'image/x-icon', 'ics' => 'text/calendar', 'ief' => 'image/ief', 'ifb' => 'text/calendar', 'ifm' => 'application/vnd.shana.informed.formdata', 'iges' => 'model/iges', 'igl' => 'application/vnd.igloader', 'igm' => 'application/vnd.insors.igm', 'igs' => 'model/iges', 'igx' => 'application/vnd.micrografx.igx', 'iif' => 'application/vnd.shana.informed.interchange', 'imp' => 'application/vnd.accpac.simply.imp', 'ims' => 'application/vnd.ms-ims', 'in' => 'text/plain', 'ink' => 'application/inkml+xml', 'inkml' => 'application/inkml+xml', 'install' => 'application/x-install-instructions', 'iota' => 'application/vnd.astraea-software.iota', 'ipfix' => 'application/ipfix', 'ipk' => 'application/vnd.shana.informed.package', 'irm' => 'application/vnd.ibm.rights-management', 'irp' => 'application/vnd.irepository.package+xml', 'iso' => 'application/x-iso9660-image', 'itp' => 'application/vnd.shana.informed.formtemplate', 'ivp' => 'application/vnd.immervision-ivp', 'ivu' => 'application/vnd.immervision-ivu', 'jad' => 'text/vnd.sun.j2me.app-descriptor', 'jam' => 'application/vnd.jam', 'jar' => 'application/java-archive', 'java' => 'text/x-java-source', 'jisp' => 'application/vnd.jisp', 'jlt' => 'application/vnd.hp-jlyt', 'jnlp' => 'application/x-java-jnlp-file', 'joda' => 'application/vnd.joost.joda-archive', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpgm' => 'video/jpm', 'jpgv' => 'video/jpeg', 'jpm' => 'video/jpm', 'js' => 'application/javascript', 'json' => 'application/json', 'jsonml' => 'application/jsonml+json', 'kar' => 'audio/midi', 'karbon' => 'application/vnd.kde.karbon', 'kfo' => 'application/vnd.kde.kformula', 'kia' => 'application/vnd.kidspiration', 'kml' => 'application/vnd.google-earth.kml+xml', 'kmz' => 'application/vnd.google-earth.kmz', 'kne' => 'application/vnd.kinar', 'knp' => 'application/vnd.kinar', 'kon' => 'application/vnd.kde.kontour', 'kpr' => 'application/vnd.kde.kpresenter', 'kpt' => 'application/vnd.kde.kpresenter', 'kpxx' => 'application/vnd.ds-keypoint', 'ksp' => 'application/vnd.kde.kspread', 'ktr' => 'application/vnd.kahootz', 'ktx' => 'image/ktx', 'ktz' => 'application/vnd.kahootz', 'kwd' => 'application/vnd.kde.kword', 'kwt' => 'application/vnd.kde.kword', 'lasxml' => 'application/vnd.las.las+xml', 'latex' => 'application/x-latex', 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', 'les' => 'application/vnd.hhe.lesson-player', 'lha' => 'application/x-lzh-compressed', 'link66' => 'application/vnd.route66.link66+xml', 'list' => 'text/plain', 'list3820' => 'application/vnd.ibm.modcap', 'listafp' => 'application/vnd.ibm.modcap', 'lnk' => 'application/x-ms-shortcut', 'log' => 'text/plain', 'lostxml' => 'application/lost+xml', 'lrf' => 'application/octet-stream', 'lrm' => 'application/vnd.ms-lrm', 'ltf' => 'application/vnd.frogans.ltf', 'lvp' => 'audio/vnd.lucent.voice', 'lwp' => 'application/vnd.lotus-wordpro', 'lzh' => 'application/x-lzh-compressed', 'm13' => 'application/x-msmediaview', 'm14' => 'application/x-msmediaview', 'm1v' => 'video/mpeg', 'm21' => 'application/mp21', 'm2a' => 'audio/mpeg', 'm2v' => 'video/mpeg', 'm3a' => 'audio/mpeg', 'm3u' => 'audio/x-mpegurl', 'm3u8' => 'application/vnd.apple.mpegurl', 'm4a' => 'audio/mp4', 'm4u' => 'video/vnd.mpegurl', 'm4v' => 'video/x-m4v', 'ma' => 'application/mathematica', 'mads' => 'application/mads+xml', 'mag' => 'application/vnd.ecowin.chart', 'maker' => 'application/vnd.framemaker', 'man' => 'text/troff', 'mar' => 'application/octet-stream', 'mathml' => 'application/mathml+xml', 'mb' => 'application/mathematica', 'mbk' => 'application/vnd.mobius.mbk', 'mbox' => 'application/mbox', 'mc1' => 'application/vnd.medcalcdata', 'mcd' => 'application/vnd.mcd', 'mcurl' => 'text/vnd.curl.mcurl', 'mdb' => 'application/x-msaccess', 'mdi' => 'image/vnd.ms-modi', 'me' => 'text/troff', 'mesh' => 'model/mesh', 'meta4' => 'application/metalink4+xml', 'metalink' => 'application/metalink+xml', 'mets' => 'application/mets+xml', 'mfm' => 'application/vnd.mfmp', 'mft' => 'application/rpki-manifest', 'mgp' => 'application/vnd.osgeo.mapguide.package', 'mgz' => 'application/vnd.proteus.magazine', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mie' => 'application/x-mie', 'mif' => 'application/vnd.mif', 'mime' => 'message/rfc822', 'mj2' => 'video/mj2', 'mjp2' => 'video/mj2', 'mk3d' => 'video/x-matroska', 'mka' => 'audio/x-matroska', 'mks' => 'video/x-matroska', 'mkv' => 'video/x-matroska', 'mlp' => 'application/vnd.dolby.mlp', 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', 'mmf' => 'application/vnd.smaf', 'mmr' => 'image/vnd.fujixerox.edmics-mmr', 'mng' => 'video/x-mng', 'mny' => 'application/x-msmoney', 'mobi' => 'application/x-mobipocket-ebook', 'mods' => 'application/mods+xml', 'mov' => 'video/quicktime', 'movie' => 'video/x-sgi-movie', 'mp2' => 'audio/mpeg', 'mp21' => 'application/mp21', 'mp2a' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'mp4' => 'video/mp4', 'mp4a' => 'audio/mp4', 'mp4s' => 'application/mp4', 'mp4v' => 'video/mp4', 'mpc' => 'application/vnd.mophun.certificate', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpg4' => 'video/mp4', 'mpga' => 'audio/mpeg', 'mpkg' => 'application/vnd.apple.installer+xml', 'mpm' => 'application/vnd.blueice.multipass', 'mpn' => 'application/vnd.mophun.application', 'mpp' => 'application/vnd.ms-project', 'mpt' => 'application/vnd.ms-project', 'mpy' => 'application/vnd.ibm.minipay', 'mqy' => 'application/vnd.mobius.mqy', 'mrc' => 'application/marc', 'mrcx' => 'application/marcxml+xml', 'ms' => 'text/troff', 'mscml' => 'application/mediaservercontrol+xml', 'mseed' => 'application/vnd.fdsn.mseed', 'mseq' => 'application/vnd.mseq', 'msf' => 'application/vnd.epson.msf', 'msh' => 'model/mesh', 'msi' => 'application/x-msdownload', 'msl' => 'application/vnd.mobius.msl', 'msty' => 'application/vnd.muvee.style', 'mts' => 'model/vnd.mts', 'mus' => 'application/vnd.musician', 'musicxml' => 'application/vnd.recordare.musicxml+xml', 'mvb' => 'application/x-msmediaview', 'mwf' => 'application/vnd.mfer', 'mxf' => 'application/mxf', 'mxl' => 'application/vnd.recordare.musicxml', 'mxml' => 'application/xv+xml', 'mxs' => 'application/vnd.triscape.mxs', 'mxu' => 'video/vnd.mpegurl', 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', 'n3' => 'text/n3', 'nb' => 'application/mathematica', 'nbp' => 'application/vnd.wolfram.player', 'nc' => 'application/x-netcdf', 'ncx' => 'application/x-dtbncx+xml', 'nfo' => 'text/x-nfo', 'ngdat' => 'application/vnd.nokia.n-gage.data', 'nitf' => 'application/vnd.nitf', 'nlu' => 'application/vnd.neurolanguage.nlu', 'nml' => 'application/vnd.enliven', 'nnd' => 'application/vnd.noblenet-directory', 'nns' => 'application/vnd.noblenet-sealer', 'nnw' => 'application/vnd.noblenet-web', 'npx' => 'image/vnd.net-fpx', 'nsc' => 'application/x-conference', 'nsf' => 'application/vnd.lotus-notes', 'ntf' => 'application/vnd.nitf', 'nzb' => 'application/x-nzb', 'oa2' => 'application/vnd.fujitsu.oasys2', 'oa3' => 'application/vnd.fujitsu.oasys3', 'oas' => 'application/vnd.fujitsu.oasys', 'obd' => 'application/x-msbinder', 'obj' => 'application/x-tgif', 'oda' => 'application/oda', 'odb' => 'application/vnd.oasis.opendocument.database', 'odc' => 'application/vnd.oasis.opendocument.chart', 'odf' => 'application/vnd.oasis.opendocument.formula', 'odft' => 'application/vnd.oasis.opendocument.formula-template', 'odg' => 'application/vnd.oasis.opendocument.graphics', 'odi' => 'application/vnd.oasis.opendocument.image', 'odm' => 'application/vnd.oasis.opendocument.text-master', 'odp' => 'application/vnd.oasis.opendocument.presentation', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', 'odt' => 'application/vnd.oasis.opendocument.text', 'oga' => 'audio/ogg', 'ogg' => 'audio/ogg', 'ogv' => 'video/ogg', 'ogx' => 'application/ogg', 'omdoc' => 'application/omdoc+xml', 'onepkg' => 'application/onenote', 'onetmp' => 'application/onenote', 'onetoc' => 'application/onenote', 'onetoc2' => 'application/onenote', 'opf' => 'application/oebps-package+xml', 'opml' => 'text/x-opml', 'oprc' => 'application/vnd.palm', 'org' => 'application/vnd.lotus-organizer', 'osf' => 'application/vnd.yamaha.openscoreformat', 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', 'otc' => 'application/vnd.oasis.opendocument.chart-template', 'otf' => 'font/otf', 'otg' => 'application/vnd.oasis.opendocument.graphics-template', 'oth' => 'application/vnd.oasis.opendocument.text-web', 'oti' => 'application/vnd.oasis.opendocument.image-template', 'otp' => 'application/vnd.oasis.opendocument.presentation-template', 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', 'ott' => 'application/vnd.oasis.opendocument.text-template', 'oxps' => 'application/oxps', 'oxt' => 'application/vnd.openofficeorg.extension', 'p' => 'text/x-pascal', 'p10' => 'application/pkcs10', 'p12' => 'application/x-pkcs12', 'p7b' => 'application/x-pkcs7-certificates', 'p7c' => 'application/pkcs7-mime', 'p7m' => 'application/pkcs7-mime', 'p7r' => 'application/x-pkcs7-certreqresp', 'p7s' => 'application/pkcs7-signature', 'p8' => 'application/pkcs8', 'pas' => 'text/x-pascal', 'paw' => 'application/vnd.pawaafile', 'pbd' => 'application/vnd.powerbuilder6', 'pbm' => 'image/x-portable-bitmap', 'pcap' => 'application/vnd.tcpdump.pcap', 'pcf' => 'application/x-font-pcf', 'pcl' => 'application/vnd.hp-pcl', 'pclxl' => 'application/vnd.hp-pclxl', 'pct' => 'image/x-pict', 'pcurl' => 'application/vnd.curl.pcurl', 'pcx' => 'image/x-pcx', 'pdb' => 'application/vnd.palm', 'pdf' => 'application/pdf', 'pfa' => 'application/x-font-type1', 'pfb' => 'application/x-font-type1', 'pfm' => 'application/x-font-type1', 'pfr' => 'application/font-tdpfr', 'pfx' => 'application/x-pkcs12', 'pgm' => 'image/x-portable-graymap', 'pgn' => 'application/x-chess-pgn', 'pgp' => 'application/pgp-encrypted', 'pic' => 'image/x-pict', 'pkg' => 'application/octet-stream', 'pki' => 'application/pkixcmp', 'pkipath' => 'application/pkix-pkipath', 'plb' => 'application/vnd.3gpp.pic-bw-large', 'plc' => 'application/vnd.mobius.plc', 'plf' => 'application/vnd.pocketlearn', 'pls' => 'application/pls+xml', 'pml' => 'application/vnd.ctc-posml', 'png' => 'image/png', 'pnm' => 'image/x-portable-anymap', 'portpkg' => 'application/vnd.macports.portpkg', 'pot' => 'application/vnd.ms-powerpoint', 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12', 'potx' => 'application/vnd.openxmlformats-officedocument.presentat' . 'ionml.template', 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12', 'ppd' => 'application/vnd.cups-ppd', 'ppm' => 'image/x-portable-pixmap', 'pps' => 'application/vnd.ms-powerpoint', 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentat' . 'ionml.slideshow', 'ppt' => 'application/vnd.ms-powerpoint', 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentat' . 'ionml.presentation', 'pqa' => 'application/vnd.palm', 'prc' => 'application/x-mobipocket-ebook', 'pre' => 'application/vnd.lotus-freelance', 'prf' => 'application/pics-rules', 'ps' => 'application/postscript', 'psb' => 'application/vnd.3gpp.pic-bw-small', 'psd' => 'image/vnd.adobe.photoshop', 'psf' => 'application/x-font-linux-psf', 'pskcxml' => 'application/pskc+xml', 'ptid' => 'application/vnd.pvi.ptid1', 'pub' => 'application/x-mspublisher', 'pvb' => 'application/vnd.3gpp.pic-bw-var', 'pwn' => 'application/vnd.3m.post-it-notes', 'pya' => 'audio/vnd.ms-playready.media.pya', 'pyv' => 'video/vnd.ms-playready.media.pyv', 'qam' => 'application/vnd.epson.quickanime', 'qbo' => 'application/vnd.intu.qbo', 'qfx' => 'application/vnd.intu.qfx', 'qps' => 'application/vnd.publishare-delta-tree', 'qt' => 'video/quicktime', 'qwd' => 'application/vnd.quark.quarkxpress', 'qwt' => 'application/vnd.quark.quarkxpress', 'qxb' => 'application/vnd.quark.quarkxpress', 'qxd' => 'application/vnd.quark.quarkxpress', 'qxl' => 'application/vnd.quark.quarkxpress', 'qxt' => 'application/vnd.quark.quarkxpress', 'ra' => 'audio/x-pn-realaudio', 'ram' => 'audio/x-pn-realaudio', 'rar' => 'application/x-rar-compressed', 'ras' => 'image/x-cmu-raster', 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', 'rdf' => 'application/rdf+xml', 'rdz' => 'application/vnd.data-vision.rdz', 'rep' => 'application/vnd.businessobjects', 'res' => 'application/x-dtbresource+xml', 'rgb' => 'image/x-rgb', 'rif' => 'application/reginfo+xml', 'rip' => 'audio/vnd.rip', 'ris' => 'application/x-research-info-systems', 'rl' => 'application/resource-lists+xml', 'rlc' => 'image/vnd.fujixerox.edmics-rlc', 'rld' => 'application/resource-lists-diff+xml', 'rm' => 'application/vnd.rn-realmedia', 'rmi' => 'audio/midi', 'rmp' => 'audio/x-pn-realaudio-plugin', 'rms' => 'application/vnd.jcp.javame.midlet-rms', 'rmvb' => 'application/vnd.rn-realmedia-vbr', 'rnc' => 'application/relax-ng-compact-syntax', 'roa' => 'application/rpki-roa', 'roff' => 'text/troff', 'rp9' => 'application/vnd.cloanto.rp9', 'rpss' => 'application/vnd.nokia.radio-presets', 'rpst' => 'application/vnd.nokia.radio-preset', 'rq' => 'application/sparql-query', 'rs' => 'application/rls-services+xml', 'rsd' => 'application/rsd+xml', 'rss' => 'application/rss+xml', 'rtf' => 'application/rtf', 'rtx' => 'text/richtext', 's' => 'text/x-asm', 's3m' => 'audio/s3m', 'saf' => 'application/vnd.yamaha.smaf-audio', 'sbml' => 'application/sbml+xml', 'sc' => 'application/vnd.ibm.secure-container', 'scd' => 'application/x-msschedule', 'scm' => 'application/vnd.lotus-screencam', 'scq' => 'application/scvp-cv-request', 'scs' => 'application/scvp-cv-response', 'scurl' => 'text/vnd.curl.scurl', 'sda' => 'application/vnd.stardivision.draw', 'sdc' => 'application/vnd.stardivision.calc', 'sdd' => 'application/vnd.stardivision.impress', 'sdkd' => 'application/vnd.solent.sdkm+xml', 'sdkm' => 'application/vnd.solent.sdkm+xml', 'sdp' => 'application/sdp', 'sdw' => 'application/vnd.stardivision.writer', 'see' => 'application/vnd.seemail', 'seed' => 'application/vnd.fdsn.seed', 'sema' => 'application/vnd.sema', 'semd' => 'application/vnd.semd', 'semf' => 'application/vnd.semf', 'ser' => 'application/java-serialized-object', 'setpay' => 'application/set-payment-initiation', 'setreg' => 'application/set-registration-initiation', 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', 'sfs' => 'application/vnd.spotfire.sfs', 'sfv' => 'text/x-sfv', 'sgi' => 'image/sgi', 'sgl' => 'application/vnd.stardivision.writer-global', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'shf' => 'application/shf+xml', 'sid' => 'image/x-mrsid-image', 'sig' => 'application/pgp-signature', 'sil' => 'audio/silk', 'silo' => 'model/mesh', 'sis' => 'application/vnd.symbian.install', 'sisx' => 'application/vnd.symbian.install', 'sit' => 'application/x-stuffit', 'sitx' => 'application/x-stuffitx', 'skd' => 'application/vnd.koan', 'skm' => 'application/vnd.koan', 'skp' => 'application/vnd.koan', 'skt' => 'application/vnd.koan', 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', 'sldx' => 'application/vnd.openxmlformats-officedocument.presentat' . 'ionml.slide', 'slt' => 'application/vnd.epson.salt', 'sm' => 'application/vnd.stepmania.stepchart', 'smf' => 'application/vnd.stardivision.math', 'smi' => 'application/smil+xml', 'smil' => 'application/smil+xml', 'smv' => 'video/x-smv', 'smzip' => 'application/vnd.stepmania.package', 'snd' => 'audio/basic', 'snf' => 'application/x-font-snf', 'so' => 'application/octet-stream', 'spc' => 'application/x-pkcs7-certificates', 'spf' => 'application/vnd.yamaha.smaf-phrase', 'spl' => 'application/x-futuresplash', 'spot' => 'text/vnd.in3d.spot', 'spp' => 'application/scvp-vp-response', 'spq' => 'application/scvp-vp-request', 'spx' => 'audio/ogg', 'sql' => 'application/x-sql', 'src' => 'application/x-wais-source', 'srt' => 'application/x-subrip', 'sru' => 'application/sru+xml', 'srx' => 'application/sparql-results+xml', 'ssdl' => 'application/ssdl+xml', 'sse' => 'application/vnd.kodak-descriptor', 'ssf' => 'application/vnd.epson.ssf', 'ssml' => 'application/ssml+xml', 'st' => 'application/vnd.sailingtracker.track', 'stc' => 'application/vnd.sun.xml.calc.template', 'std' => 'application/vnd.sun.xml.draw.template', 'stf' => 'application/vnd.wt.stf', 'sti' => 'application/vnd.sun.xml.impress.template', 'stk' => 'application/hyperstudio', 'stl' => 'application/vnd.ms-pki.stl', 'str' => 'application/vnd.pg.format', 'stw' => 'application/vnd.sun.xml.writer.template', 'sub' => 'image/vnd.dvb.subtitle', 'sub' => 'text/vnd.dvb.subtitle', 'sus' => 'application/vnd.sus-calendar', 'susp' => 'application/vnd.sus-calendar', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'svc' => 'application/vnd.dvb.service', 'svd' => 'application/vnd.svd', 'svg' => 'image/svg+xml', 'svgz' => 'image/svg+xml', 'swa' => 'application/x-director', 'swf' => 'application/x-shockwave-flash', 'swi' => 'application/vnd.aristanetworks.swi', 'sxc' => 'application/vnd.sun.xml.calc', 'sxd' => 'application/vnd.sun.xml.draw', 'sxg' => 'application/vnd.sun.xml.writer.global', 'sxi' => 'application/vnd.sun.xml.impress', 'sxm' => 'application/vnd.sun.xml.math', 'sxw' => 'application/vnd.sun.xml.writer', 't' => 'text/troff', 't3' => 'application/x-t3vm-image', 'taglet' => 'application/vnd.mynfc', 'tao' => 'application/vnd.tao.intent-module-archive', 'tar' => 'application/x-tar', 'tcap' => 'application/vnd.3gpp2.tcap', 'tcl' => 'application/x-tcl', 'teacher' => 'application/vnd.smart.teacher', 'tei' => 'application/tei+xml', 'teicorpus' => 'application/tei+xml', 'tex' => 'application/x-tex', 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', 'text' => 'text/plain', 'tfi' => 'application/thraud+xml', 'tfm' => 'application/x-tex-tfm', 'tga' => 'image/x-tga', 'thmx' => 'application/vnd.ms-officetheme', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'tmo' => 'application/vnd.tmobile-livetv', 'torrent' => 'application/x-bittorrent', 'tpl' => 'application/vnd.groove-tool-template', 'tpt' => 'application/vnd.trid.tpt', 'tr' => 'text/troff', 'tra' => 'application/vnd.trueapp', 'trm' => 'application/x-msterminal', 'tsd' => 'application/timestamped-data', 'tsv' => 'text/tab-separated-values', 'ttc' => 'font/collection', 'ttf' => 'font/ttf', 'ttl' => 'text/turtle', 'twd' => 'application/vnd.simtech-mindmapper', 'twds' => 'application/vnd.simtech-mindmapper', 'txd' => 'application/vnd.genomatix.tuxedo', 'txf' => 'application/vnd.mobius.txf', 'txt' => 'text/plain', 'u32' => 'application/x-authorware-bin', 'udeb' => 'application/x-debian-package', 'ufd' => 'application/vnd.ufdl', 'ufdl' => 'application/vnd.ufdl', 'ulx' => 'application/x-glulx', 'umj' => 'application/vnd.umajin', 'unityweb' => 'application/vnd.unity', 'uoml' => 'application/vnd.uoml+xml', 'uri' => 'text/uri-list', 'uris' => 'text/uri-list', 'urls' => 'text/uri-list', 'ustar' => 'application/x-ustar', 'utz' => 'application/vnd.uiq.theme', 'uu' => 'text/x-uuencode', 'uva' => 'audio/vnd.dece.audio', 'uvd' => 'application/vnd.dece.data', 'uvf' => 'application/vnd.dece.data', 'uvg' => 'image/vnd.dece.graphic', 'uvh' => 'video/vnd.dece.hd', 'uvi' => 'image/vnd.dece.graphic', 'uvm' => 'video/vnd.dece.mobile', 'uvp' => 'video/vnd.dece.pd', 'uvs' => 'video/vnd.dece.sd', 'uvt' => 'application/vnd.dece.ttml+xml', 'uvu' => 'video/vnd.uvvu.mp4', 'uvv' => 'video/vnd.dece.video', 'uvva' => 'audio/vnd.dece.audio', 'uvvd' => 'application/vnd.dece.data', 'uvvf' => 'application/vnd.dece.data', 'uvvg' => 'image/vnd.dece.graphic', 'uvvh' => 'video/vnd.dece.hd', 'uvvi' => 'image/vnd.dece.graphic', 'uvvm' => 'video/vnd.dece.mobile', 'uvvp' => 'video/vnd.dece.pd', 'uvvs' => 'video/vnd.dece.sd', 'uvvt' => 'application/vnd.dece.ttml+xml', 'uvvu' => 'video/vnd.uvvu.mp4', 'uvvv' => 'video/vnd.dece.video', 'uvvx' => 'application/vnd.dece.unspecified', 'uvvz' => 'application/vnd.dece.zip', 'uvx' => 'application/vnd.dece.unspecified', 'uvz' => 'application/vnd.dece.zip', 'vcard' => 'text/vcard', 'vcd' => 'application/x-cdlink', 'vcf' => 'text/x-vcard', 'vcg' => 'application/vnd.groove-vcard', 'vcs' => 'text/x-vcalendar', 'vcx' => 'application/vnd.vcx', 'vis' => 'application/vnd.visionary', 'viv' => 'video/vnd.vivo', 'vob' => 'video/x-ms-vob', 'vor' => 'application/vnd.stardivision.writer', 'vox' => 'application/x-authorware-bin', 'vrml' => 'model/vrml', 'vsd' => 'application/vnd.visio', 'vsf' => 'application/vnd.vsf', 'vss' => 'application/vnd.visio', 'vst' => 'application/vnd.visio', 'vsw' => 'application/vnd.visio', 'vtu' => 'model/vnd.vtu', 'vxml' => 'application/voicexml+xml', 'w3d' => 'application/x-director', 'wad' => 'application/x-doom', 'wav' => 'audio/x-wav', 'wax' => 'audio/x-ms-wax', 'wbmp' => 'image/vnd.wap.wbmp', 'wbs' => 'application/vnd.criticaltools.wbs+xml', 'wbxml' => 'application/vnd.wap.wbxml', 'wcm' => 'application/vnd.ms-works', 'wdb' => 'application/vnd.ms-works', 'wdp' => 'image/vnd.ms-photo', 'weba' => 'audio/webm', 'webm' => 'video/webm', 'webp' => 'image/webp', 'wg' => 'application/vnd.pmi.widget', 'wgt' => 'application/widget', 'wks' => 'application/vnd.ms-works', 'wm' => 'video/x-ms-wm', 'wma' => 'audio/x-ms-wma', 'wmd' => 'application/x-ms-wmd', 'wmf' => 'application/x-msmetafile', 'wml' => 'text/vnd.wap.wml', 'wmlc' => 'application/vnd.wap.wmlc', 'wmls' => 'text/vnd.wap.wmlscript', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wmz' => 'application/x-ms-wmz', 'wmz' => 'application/x-msmetafile', 'woff' => 'font/woff', 'woff2' => 'font/woff2', 'wpd' => 'application/vnd.wordperfect', 'wpl' => 'application/vnd.ms-wpl', 'wps' => 'application/vnd.ms-works', 'wqd' => 'application/vnd.wqd', 'wri' => 'application/x-mswrite', 'wrl' => 'model/vrml', 'wsdl' => 'application/wsdl+xml', 'wspolicy' => 'application/wspolicy+xml', 'wtb' => 'application/vnd.webturbo', 'wvx' => 'video/x-ms-wvx', 'x32' => 'application/x-authorware-bin', 'x3d' => 'model/x3d+xml', 'x3db' => 'model/x3d+binary', 'x3dbz' => 'model/x3d+binary', 'x3dv' => 'model/x3d+vrml', 'x3dvz' => 'model/x3d+vrml', 'x3dz' => 'model/x3d+xml', 'xaml' => 'application/xaml+xml', 'xap' => 'application/x-silverlight-app', 'xar' => 'application/vnd.xara', 'xbap' => 'application/x-ms-xbap', 'xbd' => 'application/vnd.fujixerox.docuworks.binder', 'xbm' => 'image/x-xbitmap', 'xdf' => 'application/xcap-diff+xml', 'xdm' => 'application/vnd.syncml.dm+xml', 'xdp' => 'application/vnd.adobe.xdp+xml', 'xdssc' => 'application/dssc+xml', 'xdw' => 'application/vnd.fujixerox.docuworks', 'xenc' => 'application/xenc+xml', 'xer' => 'application/patch-ops-error+xml', 'xfdf' => 'application/vnd.adobe.xfdf', 'xfdl' => 'application/vnd.xfdl', 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', 'xhvml' => 'application/xv+xml', 'xif' => 'image/vnd.xiff', 'xla' => 'application/vnd.ms-excel', 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12', 'xlc' => 'application/vnd.ms-excel', 'xlf' => 'application/x-xliff+xml', 'xlm' => 'application/vnd.ms-excel', 'xls' => 'application/vnd.ms-excel', 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12', 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsh' . 'eetml.sheet', 'xlt' => 'application/vnd.ms-excel', 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12', 'xltx' => 'application/vnd.openxmlformats-officedocument.spreads' . 'heetml.template', 'xlw' => 'application/vnd.ms-excel', 'xm' => 'audio/xm', 'xml' => 'application/xml', 'xo' => 'application/vnd.olpc-sugar', 'xop' => 'application/xop+xml', 'xpi' => 'application/x-xpinstall', 'xpl' => 'application/xproc+xml', 'xpm' => 'image/x-xpixmap', 'xpr' => 'application/vnd.is-xpr', 'xps' => 'application/vnd.ms-xpsdocument', 'xpw' => 'application/vnd.intercon.formnet', 'xpx' => 'application/vnd.intercon.formnet', 'xsl' => 'application/xml', 'xslt' => 'application/xslt+xml', 'xsm' => 'application/vnd.syncml+xml', 'xspf' => 'application/xspf+xml', 'xul' => 'application/vnd.mozilla.xul+xml', 'xvm' => 'application/xv+xml', 'xvml' => 'application/xv+xml', 'xwd' => 'image/x-xwindowdump', 'xyz' => 'chemical/x-xyz', 'xz' => 'application/x-xz', 'yang' => 'application/yang', 'yin' => 'application/yin+xml', 'z1' => 'application/x-zmachine', 'z2' => 'application/x-zmachine', 'z3' => 'application/x-zmachine', 'z4' => 'application/x-zmachine', 'z5' => 'application/x-zmachine', 'z6' => 'application/x-zmachine', 'z7' => 'application/x-zmachine', 'z8' => 'application/x-zmachine', 'zaz' => 'application/vnd.zzazz.deck+xml', 'zip' => 'application/zip', 'zir' => 'application/vnd.zul', 'zirz' => 'application/vnd.zul', 'zmm' => 'application/vnd.handheld-entertainment+xml', ); $info = strtolower( pathinfo( $file, PATHINFO_EXTENSION ) ); if ( array_key_exists( $info, $mime_types ) ) { return $mime_types[ $info ]; } return 'application/octet-stream'; } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Options.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Options.php deleted file mode 100644 index a4a3d99..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/Options.php +++ /dev/null @@ -1,2 +0,0 @@ -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(); } } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/PostSettings.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/PostSettings.php deleted file mode 100644 index 5a36e8b..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/PostSettings.php +++ /dev/null @@ -1,2 +0,0 @@ -default_options = array( CURLOPT_USERAGENT => 'WP2Static.com', CURLOPT_CONNECTTIMEOUT => 0, CURLOPT_TIMEOUT => 600, ); } public function applyDefaultOptions( $curl_handle ) { foreach ( $this->default_options as $option => $value ) { curl_setopt( $curl_handle, $option, $value ); } } public function postWithJSONPayloadCustomHeaders( $url, $data, $headers, $curl_options = array() ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); 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_CUSTOMREQUEST, 'POST' ); $this->applyDefaultOptions( $ch ); if ( ! empty( $curl_options ) ) { foreach ( $curl_options as $option => $value ) { curl_setopt( $ch, $option, $value ); } } curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $data ) ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); $this->body = curl_exec( $ch ); $this->status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close( $ch ); } public function getWithCustomHeaders( $url, $headers ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); 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, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'GET' ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); $this->applyDefaultOptions( $ch ); $output = curl_exec( $ch ); $this->status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); $header_size = curl_getinfo( $ch, CURLINFO_HEADER_SIZE ); $this->body = substr( $output, $header_size ); $header = substr( $output, 0, $header_size ); $raw_headers = explode( "\n", trim( mb_substr( $output, 0, $header_size ) ) ); unset( $raw_headers[0] ); $this->headers = array(); foreach ( $raw_headers as $line ) { list( $key, $val ) = explode( ':', $line, 2 ); $this->headers[ strtolower( $key ) ] = trim( $val ); } curl_close( $ch ); } public function putWithJSONPayloadCustomHeaders( $url, $data, $headers ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); 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_CUSTOMREQUEST, 'PUT' ); curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode( $data ) ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); curl_setopt( $ch, CURLOPT_USERAGENT, 'WP2Static.com' ); $this->body = curl_exec( $ch ); $this->status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close( $ch ); } public function putWithFileStreamAndHeaders( $url, $local_file, $headers ) { $ch = curl_init(); $file_stream = fopen( $local_file, 'r' ); $data_length = filesize( $local_file ); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PUT' ); curl_setopt( $ch, CURLOPT_URL, $url ); 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_UPLOAD, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $ch, CURLOPT_INFILE, $file_stream ); curl_setopt( $ch, CURLOPT_INFILESIZE, $data_length ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); $this->applyDefaultOptions( $ch ); $this->body = curl_exec( $ch ); $this->status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close( $ch ); } public function postWithFileStreamAndHeaders( $url, $local_file, $headers ) { $ch = curl_init(); $file_stream = fopen( $local_file, 'r' ); $data_length = filesize( $local_file ); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); curl_setopt( $ch, CURLOPT_URL, $url ); 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_UPLOAD, 1 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); curl_setopt( $ch, CURLOPT_INFILE, $file_stream ); curl_setopt( $ch, CURLOPT_INFILESIZE, $data_length ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); $this->applyDefaultOptions( $ch ); $this->body = curl_exec( $ch ); $this->status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close( $ch ); } public function postWithArray( $url, $data, $curl_options = array() ) { $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $url ); 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 ); $this->applyDefaultOptions( $ch ); if ( ! empty( $curl_options ) ) { foreach ( $curl_options as $option => $value ) { curl_setopt( $ch, $option, $value ); } } curl_setopt( $ch, CURLOPT_POSTFIELDS, $data ); $this->body = curl_exec( $ch ); $this->status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close( $ch ); } } $wp2static_request = new WP2Static_Request(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/SiteCrawler.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/SiteCrawler.php deleted file mode 100644 index 6417700..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/SiteCrawler.php +++ /dev/null @@ -1,2 +0,0 @@ -loadSettings( array( 'wpenv', 'crawling', 'processing', 'advanced', ) ); if ( isset( $this->settings['crawl_delay'] ) ) { sleep( $this->settings['crawl_delay'] ); } $this->processed_file = ''; $this->file_type = ''; $this->response = ''; $this->content_type = ''; $this->url = ''; $this->full_url = ''; $this->extension = ''; $this->archive_dir = ''; $this->list_of_urls_to_crawl_path = ''; $this->urls_to_crawl = ''; if ( ! defined( 'WP_CLI' ) ) { if ( $_POST['ajax_action'] === 'crawl_again' ) { $this->crawl_discovered_links(); } elseif ( $_POST['ajax_action'] === 'crawl_site' ) { $this->crawl_site(); } } } public function generate_discovered_links_list() { $second_crawl_file_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-2ND-CRAWL-LIST.txt'; $already_crawled = file( $this->settings['wp_uploads_path'] . '/WP-STATIC-INITIAL-CRAWL-LIST.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); $unique_discovered_links = array(); $discovered_links_file = $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS.txt'; if ( is_file( $discovered_links_file ) ) { $discovered_links = file( $discovered_links_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); $unique_discovered_links = array_unique( $discovered_links ); sort( $unique_discovered_links ); } file_put_contents( $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS-LOG.txt', implode( PHP_EOL, $unique_discovered_links ) ); chmod( $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS-LOG.txt', 0664 ); file_put_contents( $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS-TOTAL.txt', count( $unique_discovered_links ) ); chmod( $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS-TOTAL.txt', 0664 ); $discovered_links = array_diff( $unique_discovered_links, $already_crawled ); file_put_contents( $second_crawl_file_path, implode( PHP_EOL, $discovered_links ) ); chmod( $second_crawl_file_path, 0664 ); copy( $second_crawl_file_path, $this->settings['wp_uploads_path'] . '/WP-STATIC-FINAL-2ND-CRAWL-LIST.txt' ); chmod( $this->settings['wp_uploads_path'] . '/WP-STATIC-FINAL-2ND-CRAWL-LIST.txt', 0664 ); } public function crawl_discovered_links() { if ( defined( 'WP_CLI' ) && ! defined( 'CRAWLING_DISCOVERED' ) ) { define( 'CRAWLING_DISCOVERED', true ); } $second_crawl_file_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-2ND-CRAWL-LIST.txt'; if ( ! is_file( $second_crawl_file_path ) ) { $this->generate_discovered_links_list(); } $this->list_of_urls_to_crawl_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-FINAL-2ND-CRAWL-LIST.txt'; if ( ! is_file( $this->list_of_urls_to_crawl_path ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'ERROR: LIST OF URLS TO CRAWL NOT FOUND AT: ' . $this->list_of_urls_to_crawl_path ); die(); } else { if ( filesize( $this->list_of_urls_to_crawl_path ) ) { $this->crawlABitMore(); } else { if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } } } public function crawl_site() { $this->list_of_urls_to_crawl_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-FINAL-2ND-CRAWL-LIST.txt'; if ( is_file( $this->list_of_urls_to_crawl_path ) ) { $this->crawl_discovered_links(); return; } $this->list_of_urls_to_crawl_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-FINAL-CRAWL-LIST.txt'; if ( ! is_file( $this->list_of_urls_to_crawl_path ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'ERROR: LIST OF URLS TO CRAWL NOT FOUND AT: ' . $this->list_of_urls_to_crawl_path ); die(); } else { if ( filesize( $this->list_of_urls_to_crawl_path ) ) { $this->crawlABitMore(); } else { if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } } } public function crawlABitMore() { $batch_of_links_to_crawl = array(); $this->urls_to_crawl = file( $this->list_of_urls_to_crawl_path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); $total_links = count( $this->urls_to_crawl ); if ( $total_links < 1 ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'ERROR: LIST OF URLS TO CRAWL NOT FOUND AT: ' . $this->list_of_urls_to_crawl_path ); die(); } if ( $this->settings['crawl_increment'] > $total_links ) { $this->settings['crawl_increment'] = $total_links; } for ( $i = 0; $i < $this->settings['crawl_increment']; $i++ ) { $link_from_crawl_list = array_shift( $this->urls_to_crawl ); if ( $link_from_crawl_list ) { $batch_of_links_to_crawl[] = $link_from_crawl_list; } } $this->remaining_urls_to_crawl = count( $this->urls_to_crawl ); file_put_contents( $this->list_of_urls_to_crawl_path, implode( "\r\n", $this->urls_to_crawl ) ); chmod( $this->list_of_urls_to_crawl_path, 0664 ); $handle = fopen( $this->settings['wp_uploads_path'] . '/WP2STATIC-CURRENT-ARCHIVE.txt', 'r' ); $this->archive_dir = stream_get_line( $handle, 0 ); $total_urls_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-INITIAL-CRAWL-TOTAL.txt'; if ( defined( 'CRAWLING_DISCOVERED' ) || ( isset( $_POST['ajax_action'] ) && $_POST['ajax_action'] == 'crawl_again' ) ) { $total_urls_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-DISCOVERED-URLS-TOTAL.txt'; } $total_urls_to_crawl = file_get_contents( $total_urls_path ); $batch_index = 0; $exclusions = array( 'wp-json' ); if ( isset( $this->settings['excludeURLs'] ) ) { $user_exclusions = explode( "\n", str_replace( "\r", '', $this->settings['excludeURLs'] ) ); $exclusions = array_merge( $exclusions, $user_exclusions ); } $this->logAction( 'Exclusion rules ' . implode( PHP_EOL, $exclusions ) ); foreach ( $batch_of_links_to_crawl as $link_to_crawl ) { $this->url = $link_to_crawl; $this->full_url = $this->settings['wp_site_url'] . ltrim( $this->url, '/' ); foreach ( $exclusions as $exclusion ) { $exclusion = trim( $exclusion ); if ( $exclusion != '' ) { if ( false !== strpos( $this->url, $exclusion ) ) { $this->logAction( 'Excluding ' . $this->url . ' because of rule ' . $exclusion ); continue 2; } } } $this->file_extension = $this->getExtensionFromURL(); if ( $this->loadFileForProcessing() ) { $this->saveFile(); } $batch_index++; $completed_urls = $total_urls_to_crawl - $this->remaining_urls_to_crawl - count( $batch_of_links_to_crawl ) + $batch_index; require_once dirname( __FILE__ ) . '/../WP2Static/ProgressLog.php'; ProgressLog::l( $completed_urls, $total_urls_to_crawl ); $this->logAction( 'Memory allocated by crawl script: ' . round( memory_get_usage( true ) / 1024 ) ); } $this->checkIfMoreCrawlingNeeded(); $url_reponse = null; unset( $url_reponse ); } public function loadFileForProcessing() { $this->logAction( "Crawling {$this->url}" ); $ch = curl_init(); if ( isset( $this->settings['crawlPort'] ) ) { curl_setopt( $ch, CURLOPT_PORT, $this->settings['crawlPort'] ); } curl_setopt( $ch, CURLOPT_URL, $this->full_url ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt( $ch, CURLOPT_USERAGENT, 'WP2Static.com' ); curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 0 ); curl_setopt( $ch, CURLOPT_TIMEOUT, 600 ); curl_setopt( $ch, CURLOPT_HEADER, 0 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 ); if ( isset( $this->settings['useBasicAuth'] ) ) { curl_setopt( $ch, CURLOPT_USERPWD, $this->settings['basicAuthUser'] . ':' . $this->settings['basicAuthPassword'] ); } $output = curl_exec( $ch ); $this->checkForCurlErrors( $output, $ch ); $status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); $this->curl_content_type = curl_getinfo( $ch, CURLINFO_CONTENT_TYPE ); curl_close( $ch ); $this->response = $output; $this->crawled_links_file = $this->settings['wp_uploads_path'] . '/WP-STATIC-CRAWLED-LINKS.txt'; $good_response_codes = array( '200', '201', '301', '302', '304' ); if ( ! in_array( $status_code, $good_response_codes ) ) { $this->logAction( 'BAD RESPONSE STATUS (' . $status_code . '): ' . $this->url ); return false; file_put_contents( $this->settings['wp_uploads_path'] . '/WP-STATIC-404-LOG.txt', $status_code . ':' . $this->url . PHP_EOL, FILE_APPEND | LOCK_EX ); chmod( $this->settings['wp_uploads_path'] . '/WP-STATIC-404-LOG.txt', 0664 ); } else { file_put_contents( $this->crawled_links_file, $this->url . PHP_EOL, FILE_APPEND | LOCK_EX ); chmod( $this->crawled_links_file, 0664 ); } $base_url = $this->settings['baseUrl']; $this->detectFileType( $this->full_url ); switch ( $this->file_type ) { case 'html': require_once dirname( __FILE__ ) . '/../WP2Static/WP2Static.php'; require_once dirname( __FILE__ ) . '/../WP2Static/HTMLProcessor.php'; $processor = new HTMLProcessor(); $this->processed_file = $processor->processHTML( $this->response, $this->full_url ); if ( $this->processed_file ) { $this->processed_file = $processor->getHTML(); } break; case 'css': require_once dirname( __FILE__ ) . '/../WP2Static/WP2Static.php'; require_once dirname( __FILE__ ) . '/../WP2Static/CSSProcessor.php'; $processor = new CSSProcessor(); $this->processed_file = $processor->processCSS( $this->response, $this->full_url ); if ( $this->processed_file ) { $this->processed_file = $processor->getCSS(); } break; case 'txt': case 'js': case 'json': case 'xml': require_once dirname( __FILE__ ) . '/../WP2Static/WP2Static.php'; require_once dirname( __FILE__ ) . '/../WP2Static/TXTProcessor.php'; $processor = new TXTProcessor(); $this->processed_file = $processor->processTXT( $this->response, $this->full_url ); if ( $this->processed_file ) { $this->processed_file = $processor->getTXT(); } break; default: $this->processed_file = $this->response; break; } return true; } public function checkIfMoreCrawlingNeeded() { if ( $this->remaining_urls_to_crawl > 0 ) { if ( ! defined( 'WP_CLI' ) ) { echo $this->remaining_urls_to_crawl; } else { $this->crawl_site(); } } else { if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } } public function saveFile() { require_once dirname( __FILE__ ) . '/../WP2Static/FileWriter.php'; $file_writer = new FileWriter( $this->url, $this->processed_file, $this->file_type, $this->content_type ); $file_writer->saveFile( $this->archive_dir ); } public function getExtensionFromURL() { $url_path = parse_url( $this->url, PHP_URL_PATH ); $extension = pathinfo( $url_path, PATHINFO_EXTENSION ); if ( ! $extension ) { return ''; } return $extension; } public function detectFileType() { if ( $this->file_extension ) { $this->file_type = $this->file_extension; } else { $type = $this->content_type = $this->curl_content_type; if ( stripos( $type, 'text/html' ) !== false ) { $this->file_type = 'html'; } elseif ( stripos( $type, 'rss+xml' ) !== false ) { $this->file_type = 'xml'; } elseif ( stripos( $type, 'text/xml' ) !== false ) { $this->file_type = 'xml'; } elseif ( stripos( $type, 'application/xml' ) !== false ) { $this->file_type = 'xml'; } elseif ( stripos( $type, 'application/json' ) !== false ) { $this->file_type = 'json'; } else { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'no filetype inferred from content-type: ' . $this->curl_content_type . ' url: ' . $this->url ); } } } public function logAction( $action ) { if ( ! isset( $this->settings['debug_mode'] ) ) { return; } require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( $action ); } public function checkForCurlErrors( $response, $curl_handle ) { if ( $response === false ) { $response = curl_error( $curl_handle ); $this->logAction( 'cURL error:' . stripslashes( $response ) ); } } } $site_crawler = new SiteCrawler(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/SitePublisher.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/SitePublisher.php deleted file mode 100644 index 01d20af..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/SitePublisher.php +++ /dev/null @@ -1,2 +0,0 @@ -settings = WPSHO_PostSettings::get( $target_settings ); } else { require_once dirname( __FILE__ ) . '/DBSettings.php'; $this->settings = WPSHO_DBSettings::get( $target_settings ); } } public function loadArchive() { require_once dirname( __FILE__ ) . '/WP2Static.php'; require_once dirname( __FILE__ ) . '/Archive.php'; $this->archive = new Archive(); $this->archive->setToCurrentArchive(); } public function bootstrap() { $this->export_file_list = $this->settings['wp_uploads_path'] . '/WP2STATIC-FILES-TO-DEPLOY.txt'; $this->archive_dir = file_get_contents( $this->settings['wp_uploads_path'] . '/WP2STATIC-CURRENT-ARCHIVE.txt' ); } public function pauseBetweenAPICalls() { if ( isset( $this->settings['delayBetweenAPICalls'] ) && $this->settings['delayBetweenAPICalls'] > 0 ) { sleep( $this->settings['delayBetweenAPICalls'] ); } } public function updateProgress() { $this->batch_index++; $completed_urls = $this->total_urls_to_crawl - $this->files_remaining + $this->batch_index; require_once dirname( __FILE__ ) . '/ProgressLog.php'; ProgressLog::l( $completed_urls, $this->total_urls_to_crawl ); } public function initiateProgressIndicator() { $this->deploy_count_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-TOTAL-FILES-TO-DEPLOY.txt'; $this->total_urls_to_crawl = file_get_contents( $this->deploy_count_path ); $this->batch_index = 0; } public function clearFileList() { if ( is_file( $this->export_file_list ) ) { $f = fopen( $this->export_file_list, 'r+' ); if ( $f !== false ) { ftruncate( $f, 0 ); fclose( $f ); } } if ( isset( $this->glob_hash_path_list ) ) { if ( is_file( $this->glob_hash_path_list ) ) { $f = fopen( $this->glob_hash_path_list, 'r+' ); if ( $f !== false ) { ftruncate( $f, 0 ); fclose( $f ); } } } } public function isSkippableFile( $file ) { if ( $file == '.' || $file == '..' || $file == '.git' ) { return true; } } public function getLocalFileToDeploy( $file_in_archive, $replace_path ) { $original_filepath = str_replace( '\\', '\\\\', $file_in_archive ); $original_file_without_archive = str_replace( $replace_path, '', $original_filepath ); $original_file_without_archive = ltrim( $original_file_without_archive, '/' ); return $original_file_without_archive; } public function getArchivePathForReplacement( $archive_path ) { $local_path_to_strip = $archive_path; $local_path_to_strip = rtrim( $local_path_to_strip, '/' ); $local_path_to_strip = str_replace( '//', '/', $local_path_to_strip ); return $local_path_to_strip; } public function getRemoteDeploymentPath( $dir, $file_in_archive, $archive_path_to_replace, $basename_in_target ) { $deploy_path = str_replace( $archive_path_to_replace, '', $dir ); $deploy_path = ltrim( $deploy_path, '/' ); $deploy_path .= '/'; if ( $basename_in_target ) { $deploy_path .= basename( $file_in_archive ); } $deploy_path = ltrim( $deploy_path, '/' ); return $deploy_path; } public function createDeploymentList( $dir, $basename_in_target ) { $archive_path_to_replace = $this->getArchivePathForReplacement( $this->archive->path ); foreach ( scandir( $dir ) as $item ) { if ( $this->isSkippableFile( $item ) ) { continue; } $file_in_archive = $dir . '/' . $item; if ( is_dir( $file_in_archive ) ) { $this->createDeploymentList( $file_in_archive, $basename_in_target ); } elseif ( is_file( $file_in_archive ) ) { $local_file_path = $this->getLocalFileToDeploy( $file_in_archive, $archive_path_to_replace ); $remote_deployment_path = $this->getRemoteDeploymentPath( $dir, $file_in_archive, $archive_path_to_replace, $basename_in_target ); file_put_contents( $this->export_file_list, $local_file_path . ',' . $remote_deployment_path . PHP_EOL, FILE_APPEND | LOCK_EX ); chmod( $this->export_file_list, 0664 ); } } } public function prepareDeploy( $basename_in_target = false ) { $this->clearFileList(); $this->createDeploymentList( $this->settings['wp_uploads_path'] . '/' . $this->archive->name, $basename_in_target ); $linecount = 0; $handle = fopen( $this->export_file_list, 'r' ); while ( ! feof( $handle ) ) { $line = fgets( $handle ); $linecount++; } fclose( $handle ); $deploy_count_path = $this->settings['wp_uploads_path'] . '/WP-STATIC-TOTAL-FILES-TO-DEPLOY.txt'; file_put_contents( $deploy_count_path, $linecount, LOCK_EX ); chmod( $deploy_count_path, 0664 ); if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } public function getItemsToDeploy( $batch_size = 1 ) { $lines = array(); $f = fopen( $this->export_file_list, 'r' ); for ( $i = 0; $i < $batch_size; $i++ ) { $lines[] = rtrim( fgets( $f ) ); } fclose( $f ); $contents = file( $this->export_file_list, FILE_IGNORE_NEW_LINES ); for ( $i = 0; $i < $batch_size; $i++ ) { array_shift( $contents ); } file_put_contents( $this->export_file_list, implode( PHP_EOL, $contents ) ); chmod( $this->export_file_list, 0664 ); return $lines; } public function getRemainingItemsCount() { $contents = file( $this->export_file_list, FILE_IGNORE_NEW_LINES ); return count( $contents ); } public function finalizeDeployment() { if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } public function uploadsCompleted() { $this->files_remaining = $this->getRemainingItemsCount(); if ( $this->files_remaining <= 0 ) { return true; } else { if ( defined( 'WP_CLI' ) ) { $this->upload_files(); } else { echo $this->files_remaining; } } } public function handleException( $e ) { require_once dirname( __FILE__ ) . '/WsLog.php'; WsLog::l( 'Deployment: error encountered' ); WsLog::l( $e ); throw new Exception( $e ); } public function checkForValidResponses( $code, $good_codes ) { if ( ! in_array( $code, $good_codes ) ) { require_once dirname( __FILE__ ) . '/WsLog.php'; WsLog::l( 'BAD RESPONSE STATUS FROM API (' . $code . ')' ); http_response_code( $code ); throw new Exception( 'BAD RESPONSE STATUS FROM API (' . $code . ')' ); } } public function openPreviousHashesFile() { $this->file_paths_and_hashes = array(); if ( is_file( $this->previous_hashes_path ) ) { $file = fopen( $this->previous_hashes_path, 'r' ); while ( ( $line = fgetcsv( $file ) ) !== false ) { if ( isset( $line[0] ) && isset( $line[1] ) ) { $this->file_paths_and_hashes[ $line[0] ] = $line[1]; } } fclose( $file ); } } public function recordFilePathAndHashInMemory( $target_path, $local_file_contents ) { $this->file_paths_and_hashes[ $target_path ] = crc32( $local_file_contents ); } public function writeFilePathAndHashesToFile() { $fp = fopen( $this->previous_hashes_path, 'w' ); foreach ( $this->file_paths_and_hashes as $key => $value ) { fwrite( $fp, $key . ',' . $value . PHP_EOL ); } fclose( $fp ); } public function logAction( $action ) { if ( ! isset( $this->settings['debug_mode'] ) ) { return; } require_once dirname( __FILE__ ) . '/WsLog.php'; WsLog::l( $action ); } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/TXTProcessor.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/TXTProcessor.php deleted file mode 100644 index 61ce3dd..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/TXTProcessor.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/TemplateHelper.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/TemplateHelper.php deleted file mode 100644 index 973c256..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/TemplateHelper.php +++ /dev/null @@ -1,17 +0,0 @@ - - - - '; } public function displayTextfield( $tpl_vars, $field_name, $field_label, $description, $type = 'text' ) { echo " - - $description -
- "; } public function displaySelectMenu( $tpl_vars, $menu_options, $field_name, $field_label, $description, $type = 'text' ) { $menu_code = " - '; echo $menu_code; } public function ifNotEmpty( $value, $substitute = '' ) { $value = $value ? $value : $substitute; echo $value; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/View.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/View.php deleted file mode 100644 index 4a4c8e2..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/View.php +++ /dev/null @@ -1,2 +0,0 @@ -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; } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WP2Static.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WP2Static.php deleted file mode 100644 index 5adc456..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WP2Static.php +++ /dev/null @@ -1,2 +0,0 @@ -settings = WPSHO_PostSettings::get( $target_settings ); } else { require_once dirname( __FILE__ ) . '/DBSettings.php'; $this->settings = WPSHO_DBSettings::get( $target_settings ); } } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WPSite.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WPSite.php deleted file mode 100644 index 1d4b62b..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WPSite.php +++ /dev/null @@ -1,2 +0,0 @@ -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 ''; } } } \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WsLog.php b/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WsLog.php deleted file mode 100644 index 1792feb..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/WP2Static/WsLog.php +++ /dev/null @@ -1,2 +0,0 @@ -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(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/deployers/BunnyCDN.php b/wp-content/plugins/static-html-output-plugin/plugin/deployers/BunnyCDN.php deleted file mode 100644 index 892e707..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/deployers/BunnyCDN.php +++ /dev/null @@ -1,2 +0,0 @@ -loadSettings( 'bunnycdn' ); $this->api_base = 'https://storage.bunnycdn.com'; $this->previous_hashes_path = $this->settings['wp_uploads_path'] . '/WP2STATIC-BUNNYCDN-PREVIOUS-HASHES.txt'; if ( defined( 'WP_CLI' ) ) { return; } switch ( $_POST['ajax_action'] ) { case 'bunnycdn_prepare_export': $this->bootstrap(); $this->loadArchive(); $this->prepareDeploy( true ); break; case 'bunnycdn_transfer_files': $this->bootstrap(); $this->loadArchive(); $this->upload_files(); break; case 'bunnycdn_purge_cache': $this->purge_all_cache(); break; case 'test_bunny': $this->test_deploy(); 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($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['bunnycdnRemotePath'] ) ) { $this->target_path = $this->settings['bunnycdnRemotePath'] . '/' . $this->target_path; } $this->local_file_contents = file_get_contents( $this->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->fileExistsInBunnyCDN() ) { $this->updateFileInBunnyCDN(); } else { $this->createFileInBunnyCDN(); } $this->recordFilePathAndHashInMemory( $this->target_path, $this->local_file_contents ); } } else { if ( $this->fileExistsInBunnyCDN() ) { $this->updateFileInBunnyCDN(); } else { $this->createFileInBunnyCDN(); } $this->recordFilePathAndHashInMemory( $this->target_path, $this->local_file_contents ); } $this->updateProgress(); } $this->writeFilePathAndHashesToFile(); $this->pauseBetweenAPICalls(); if ( $this->uploadsCompleted() ) { $this->finalizeDeployment(); } } public function purge_all_cache() { try { $endpoint = 'https://bunnycdn.com/api/pullzone/' . $this->settings['bunnycdnPullZoneID'] . '/purgeCache'; $ch = curl_init(); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'POST' ); curl_setopt( $ch, CURLOPT_URL, $endpoint ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 0 ); curl_setopt( $ch, CURLOPT_POST, 1 ); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: 0', 'AccessKey: ' . $this->settings['bunnycdnPullZoneAccessKey'], ) ); $output = curl_exec( $ch ); $status_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close( $ch ); $good_response_codes = array( '200', '201' ); if ( ! in_array( $status_code, $good_response_codes ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'BAD RESPONSE STATUS (' . $status_code . '): ' ); echo 'FAIL'; throw new Exception( 'BunnyCDN API bad response status' ); } if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } catch ( Exception $e ) { WsLog::l( 'BUNNYCDN EXPORT: error encountered' ); WsLog::l( $e ); throw new Exception( $e ); } } public function test_deploy() { try { $remote_path = $this->api_base . '/' . $this->settings['bunnycdnStorageZoneName'] . '/tmpFile'; $ch = curl_init(); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PUT' ); curl_setopt( $ch, CURLOPT_URL, $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_HTTPHEADER, array( 'AccessKey: ' . $this->settings['bunnycdnStorageZoneAccessKey'], ) ); $post_options = array( 'body' => 'Test WP2Static connectivity', ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_options ); $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( 'BunnyCDN API bad response status' ); } } catch ( Exception $e ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'BUNNYCDN EXPORT: error encountered' ); WsLog::l( $e ); throw new Exception( $e ); } if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } public function fileExistsInBunnyCDN() { require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $this->client = new WP2Static_Request(); return false; } public function createFileInBunnyCDN() { try { $remote_path = $this->api_base . '/' . $this->settings['bunnycdnStorageZoneName'] . '/' . $this->target_path; $headers = array( 'AccessKey: ' . $this->settings['bunnycdnStorageZoneAccessKey'], ); $this->client->putWithFileStreamAndHeaders( $remote_path, $this->local_file, $headers ); $this->checkForValidResponses( $this->client->status_code, array( '200', '201', '301', '302', '304' ) ); } catch ( Exception $e ) { $this->handleException( $e ); } } } $bunny = new WP2Static_BunnyCDN(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/deployers/FTP.php b/wp-content/plugins/static-html-output-plugin/plugin/deployers/FTP.php deleted file mode 100644 index b02e0a3..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/deployers/FTP.php +++ /dev/null @@ -1,2 +0,0 @@ -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(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/deployers/GitHub.php b/wp-content/plugins/static-html-output-plugin/plugin/deployers/GitHub.php deleted file mode 100644 index 2cc72a7..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/deployers/GitHub.php +++ /dev/null @@ -1,14 +0,0 @@ -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 = <<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(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/deployers/GitLab.php b/wp-content/plugins/static-html-output-plugin/plugin/deployers/GitLab.php deleted file mode 100644 index a371d10..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/deployers/GitLab.php +++ /dev/null @@ -1,16 +0,0 @@ -loadSettings( 'gitlab' ); $this->files_in_repo_list_path = $this->settings['wp_uploads_path'] . '/WP2STATIC-GITLAB-FILES-IN-REPO.txt'; $this->previous_hashes_path = $this->settings['wp_uploads_path'] . '/WP2STATIC-GITLAB-PREVIOUS-HASHES.txt'; if ( defined( 'WP_CLI' ) ) { return; } switch ( $_POST['ajax_action'] ) { case 'gitlab_prepare_export': $this->bootstrap(); $this->loadArchive(); $this->getListOfFilesInRepo(); $this->prepareDeploy( true ); break; case 'gitlab_upload_files': $this->bootstrap(); $this->loadArchive(); $this->upload_files(); break; case 'test_gitlab': $this->test_file_create(); 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 ); $files_in_tree = file( $this->files_in_repo_list_path, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); $files_in_tree = array_filter( $files_in_tree ); $files_in_tree = array_unique( $files_in_tree ); $files_data = array(); $this->openPreviousHashesFile(); foreach ( $lines as $line ) { list($local_file, $target_path) = explode( ',', $line ); $local_file = $this->archive->path . $local_file; if ( ! is_file( $local_file ) ) { continue; } if ( isset( $this->settings['glPath'] ) ) { $target_path = $this->settings['glPath'] . '/' . $target_path; } $local_file_contents = file_get_contents( $local_file ); if ( in_array( $target_path, $files_in_tree ) ) { if ( isset( $this->file_paths_and_hashes[ $target_path ] ) ) { $prev = $this->file_paths_and_hashes[ $target_path ]; $current = crc32( $local_file_contents ); if ( $prev != $current ) { $files_data[] = array( 'action' => 'update', 'file_path' => $target_path, 'content' => base64_encode( $local_file_contents ), 'encoding' => 'base64', ); } } else { $files_data[] = array( 'action' => 'update', 'file_path' => $target_path, 'content' => base64_encode( $local_file_contents ), 'encoding' => 'base64', ); } } else { $files_data[] = array( 'action' => 'create', 'file_path' => $target_path, 'content' => base64_encode( $local_file_contents ), 'encoding' => 'base64', ); } $this->recordFilePathAndHashInMemory( $target_path, $local_file_contents ); $this->updateProgress(); } $this->pauseBetweenAPICalls(); $commits_endpoint = 'https://gitlab.com/api/v4/projects/' . $this->settings['glProject'] . '/repository/commits'; try { require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $client = new WP2Static_Request(); $post_options = array( 'branch' => 'master', 'commit_message' => 'WP2Static Deployment', 'actions' => $files_data, ); $headers = array( 'PRIVATE-TOKEN: ' . $this->settings['glToken'], 'Content-Type: application/json', ); $client->postWithJSONPayloadCustomHeaders( $commits_endpoint, $post_options, $headers ); $this->checkForValidResponses( $client->status_code, array( '200', '201', '301', '302', '304' ) ); $this->writeFilePathAndHashesToFile(); } catch ( Exception $e ) { $this->handleException( $e ); } if ( $this->uploadsCompleted() ) { $this->createGitLabPagesConfig(); $this->finalizeDeployment(); } } public function addToListOfFilesInRepos( $items ) { file_put_contents( $this->files_in_repo_list_path, implode( PHP_EOL, $items ) . PHP_EOL, FILE_APPEND | LOCK_EX ); } public function getFilePathsFromTree( $json_response ) { $partial_tree_array = json_decode( (string) $json_response, true ); $formatted_elements = array(); foreach ( $partial_tree_array as $object ) { if ( $object['type'] === 'blob' ) { $formatted_elements[] = $object['path']; } } return $formatted_elements; } public function getRepositoryTree( $page ) { $tree_endpoint = 'https://gitlab.com/api/v4/projects/' . $this->settings['glProject'] . '/repository/tree?recursive=true&per_page=100&page=' . $page; require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $client = new WP2Static_Request(); $headers = array( 'PRIVATE-TOKEN: ' . $this->settings['glToken'], 'Content-Type: application/json', ); $client->getWithCustomHeaders( $tree_endpoint, $headers ); $good_response_codes = array( '200', '201', '301', '302', '304' ); if ( ! in_array( $client->status_code, $good_response_codes ) ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'BAD RESPONSE STATUS (' . $client->status_code . '): ' ); throw new Exception( 'GitLab API bad response status' ); } $total_pages = $client->headers['x-total-pages']; $next_page = $client->headers['x-next-page']; $current_page = $client->headers['x-page']; $json_items = $client->body; $this->addToListOfFilesInRepos( $this->getFilePathsFromTree( $json_items ) ); if ( $current_page < $total_pages ) { $this->getRepositoryTree( $next_page ); } } public function getListOfFilesInRepo() { $this->getRepositoryTree( 1 ); } public function test_file_create() { $remote_path = 'https://gitlab.com/api/v4/projects/' . $this->settings['glProject'] . '/repository/commits'; try { require_once dirname( __FILE__ ) . '/../WP2Static/Request.php'; $client = new WP2Static_Request(); $post_options = array( 'branch' => 'master', 'commit_message' => 'test deploy from plugin', 'actions' => array( array( 'action' => 'create', 'file_path' => '.wpsho_' . time(), 'content' => 'test file', ), array( 'action' => 'create', 'file_path' => '.wpsho2_' . time(), 'content' => 'test file 2', ), ), ); $headers = array( 'PRIVATE-TOKEN: ' . $this->settings['glToken'], 'Content-Type: application/json', ); $client->postWithJSONPayloadCustomHeaders( $remote_path, $post_options, $headers ); $this->checkForValidResponses( $client->status_code, array( '200', '201', '301', '302', '304' ) ); } catch ( Exception $e ) { $this->handleException( $e ); } $this->finalizeDeployment(); } public function createGitLabPagesConfig() { $config_file = <<archive->path . '.gitlab-ci.yml'; file_put_contents( $target_path, $config_file ); chmod( $target_path, 0664 ); $export_line = '.gitlab-ci.yml,.gitlab-ci.yml'; file_put_contents( $this->export_file_list, $export_line . PHP_EOL, FILE_APPEND | LOCK_EX ); chmod( $this->export_file_list, 0664 ); } } $gitlab = new WP2Static_GitLab(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/deployers/Netlify.php b/wp-content/plugins/static-html-output-plugin/plugin/deployers/Netlify.php deleted file mode 100644 index 9b0887c..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/deployers/Netlify.php +++ /dev/null @@ -1,2 +0,0 @@ -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(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/deployers/S3.php b/wp-content/plugins/static-html-output-plugin/plugin/deployers/S3.php deleted file mode 100644 index f638c6d..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/deployers/S3.php +++ /dev/null @@ -1,8 +0,0 @@ -loadSettings( 's3' ); $this->previous_hashes_path = $this->settings['wp_uploads_path'] . '/WP2STATIC-S3-PREVIOUS-HASHES.txt'; if ( defined( 'WP_CLI' ) ) { return; } switch ( $_POST['ajax_action'] ) { case 'test_s3': $this->test_s3(); break; case 's3_prepare_export': $this->bootstrap(); $this->loadArchive(); $this->prepareDeploy(); break; case 's3_transfer_files': $this->bootstrap(); $this->loadArchive(); $this->upload_files(); break; case 'cloudfront_invalidate_all_items': $this->cloudfront_invalidate_all_items(); 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 dirname( __FILE__ ) . '/../WP2Static/MimeTypes.php'; 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['s3RemotePath'] ) ) { $this->target_path = $this->settings['s3RemotePath'] . '/' . $this->target_path; } $this->logAction( "Uploading {$local_file} to {$this->target_path} in S3" ); $this->local_file_contents = file_get_contents( $local_file ); $this->hash_key = $this->target_path . basename( $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 ) { try { $this->put_s3_object( $this->target_path . basename( $local_file ), $this->local_file_contents, GuessMimeType( $local_file ) ); } catch ( Exception $e ) { $this->handleException( $e ); } } else { $this->logAction( "Skipping {$this->hash_key} as identical " . 'to deploy cache' ); } } else { try { $this->put_s3_object( $this->target_path . basename( $local_file ), $this->local_file_contents, GuessMimeType( $local_file ) ); } catch ( Exception $e ) { $this->handleException( $e ); } } $this->recordFilePathAndHashInMemory( $this->hash_key, $this->local_file_contents ); $this->updateProgress(); } $this->writeFilePathAndHashesToFile(); $this->pauseBetweenAPICalls(); if ( $this->uploadsCompleted() ) { $this->finalizeDeployment(); } } public function test_s3() { try { $this->put_s3_object( '.tmp_wp2static.txt', 'Test WP2Static connectivity', 'text/plain' ); if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } catch ( Exception $e ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( 'S3 ERROR RETURNED: ' . $e ); echo "There was an error testing S3.\n"; } } public function put_s3_object( $s3_path, $content, $content_type ) { $s3_path = str_replace( '@', '%40', $s3_path ); $this->logAction( "PUT'ing file to {$s3_path} in S3" ); $host_name = $this->settings['s3Bucket'] . '.s3.' . $this->settings['s3Region'] . '.amazonaws.com'; $this->logAction( "Using S3 Endpoint {$host_name}" ); $content_acl = 'public-read'; $content_title = $s3_path; $aws_service_name = 's3'; $timestamp = gmdate( 'Ymd\THis\Z' ); $date = gmdate( 'Ymd' ); $request_headers = array(); $request_headers['Content-Type'] = $content_type; $request_headers['Date'] = $timestamp; $request_headers['Host'] = $host_name; $request_headers['x-amz-acl'] = $content_acl; $request_headers['x-amz-content-sha256'] = hash( 'sha256', $content ); ksort( $request_headers ); $canonical_headers = array(); foreach ( $request_headers as $key => $value ) { $canonical_headers[] = strtolower( $key ) . ':' . $value; } $canonical_headers = implode( "\n", $canonical_headers ); $signed_headers = array(); foreach ( $request_headers as $key => $value ) { $signed_headers[] = strtolower( $key ); } $signed_headers = implode( ';', $signed_headers ); $canonical_request = array(); $canonical_request[] = 'PUT'; $canonical_request[] = '/' . $content_title; $canonical_request[] = ''; $canonical_request[] = $canonical_headers; $canonical_request[] = ''; $canonical_request[] = $signed_headers; $canonical_request[] = hash( 'sha256', $content ); $canonical_request = implode( "\n", $canonical_request ); $hashed_canonical_request = hash( 'sha256', $canonical_request ); $scope = array(); $scope[] = $date; $scope[] = $this->settings['s3Region']; $scope[] = $aws_service_name; $scope[] = 'aws4_request'; $string_to_sign = array(); $string_to_sign[] = 'AWS4-HMAC-SHA256'; $string_to_sign[] = $timestamp; $string_to_sign[] = implode( '/', $scope ); $string_to_sign[] = $hashed_canonical_request; $string_to_sign = implode( "\n", $string_to_sign ); $k_secret = 'AWS4' . $this->settings['s3Secret']; $k_date = hash_hmac( 'sha256', $date, $k_secret, true ); $k_region = hash_hmac( 'sha256', $this->settings['s3Region'], $k_date, true ); $k_service = hash_hmac( 'sha256', $aws_service_name, $k_region, true ); $k_signing = hash_hmac( 'sha256', 'aws4_request', $k_service, true ); $signature = hash_hmac( 'sha256', $string_to_sign, $k_signing ); $authorization = [ 'Credential=' . $this->settings['s3Key'] . '/' . implode( '/', $scope ), 'SignedHeaders=' . $signed_headers, 'Signature=' . $signature, ]; $authorization = 'AWS4-HMAC-SHA256' . ' ' . implode( ',', $authorization ); $curl_headers = [ 'Authorization: ' . $authorization ]; foreach ( $request_headers as $key => $value ) { $curl_headers[] = $key . ': ' . $value; } $url = 'http://' . $host_name . '/' . $content_title; $this->logAction( "S3 URL: {$url}" ); $ch = curl_init( $url ); curl_setopt( $ch, CURLOPT_HEADER, false ); curl_setopt( $ch, CURLOPT_HTTPHEADER, $curl_headers ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, 'PUT' ); curl_setopt( $ch, CURLOPT_USERAGENT, 'WP2Static.com' ); curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 0 ); curl_setopt( $ch, CURLOPT_TIMEOUT, 600 ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $content ); $output = curl_exec( $ch ); $http_code = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); $this->logAction( "API response code: {$http_code}" ); $this->logAction( "API response body: {$output}" ); $this->checkForValidResponses( $http_code, array( '200' ) ); curl_close( $ch ); } public function cloudfront_invalidate_all_items() { $this->logAction( 'Invalidating all CloudFront items' ); if ( ! isset( $this->settings['cfDistributionId'] ) ) { error_log( 'no CF ID found' ); if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } return; } $distribution = $this->settings['cfDistributionId']; $access_key = $this->settings['s3Key']; $secret_key = $this->settings['s3Secret']; $epoch = date( 'U' ); $xml = << - /* - {$distribution}{$epoch} - -EOD; -$len = strlen( $xml ); $date = gmdate( 'D, d M Y G:i:s T' ); $sig = base64_encode( hash_hmac( 'sha1', $date, $secret_key, true ) ); $msg = 'POST /2010-11-01/distribution/'; $msg .= "{$distribution}/invalidation HTTP/1.0\r\n"; $msg .= "Host: cloudfront.amazonaws.com\r\n"; $msg .= "Date: {$date}\r\n"; $msg .= "Content-Type: text/xml; charset=UTF-8\r\n"; $msg .= "Authorization: AWS {$access_key}:{$sig}\r\n"; $msg .= "Content-Length: {$len}\r\n\r\n"; $msg .= $xml; $fp = fsockopen( 'ssl://cloudfront.amazonaws.com', 443, $errno, $errstr, 30 ); if ( ! $fp ) { require_once dirname( __FILE__ ) . '/../WP2Static/WsLog.php'; WsLog::l( "CLOUDFRONT CONNECTION ERROR: {$errno} {$errstr}" ); die( "Connection failed: {$errno} {$errstr}\n" ); } fwrite( $fp, $msg ); $resp = ''; while ( ! feof( $fp ) ) { $resp .= fgets( $fp, 1024 ); } $this->logAction( "CloudFront response body: {$resp}" ); fclose( $fp ); if ( ! defined( 'WP_CLI' ) ) { echo 'SUCCESS'; } } } $s3 = new WP2Static_S3(); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/plugin/wp2static-wp-cli-commands.php b/wp-content/plugins/static-html-output-plugin/plugin/wp2static-wp-cli-commands.php deleted file mode 100644 index a5bd0d2..0000000 --- a/wp-content/plugins/static-html-output-plugin/plugin/wp2static-wp-cli-commands.php +++ /dev/null @@ -1,2 +0,0 @@ - '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: ' ); } $plugin = WP2Static_Controller::getInstance(); if ( $action === 'get' ) { if ( empty( $option_name ) ) { WP_CLI::error( 'Missing required argument: ' ); } 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: ' ); } if ( empty( $value ) ) { WP_CLI::error( 'Missing required argument: ' ); } 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' ); \ No newline at end of file diff --git a/wp-content/plugins/static-html-output-plugin/readme.txt b/wp-content/plugins/static-html-output-plugin/readme.txt deleted file mode 100644 index 8c791c5..0000000 --- a/wp-content/plugins/static-html-output-plugin/readme.txt +++ /dev/null @@ -1,1009 +0,0 @@ -=== WP2Static === -Contributors: leonstafford -Tags: security, performance, static -Requires at least: 3.2 -Tested up to: 5.3 -Requires PHP: 7.0 -Stable tag: 6.6.7 - -Security & Performance via static website publishing. One plugin to solve WordPress's biggest problems. - -== Description == - -Security & Performance via static website publishing. One plugin to solve WordPress's biggest problems. - -Keep using WordPress for what it's best at - managing content, but remove the security and performance headaches by publishing the site as static HTML. - -A static site closes all the doors that an out of date WordPress, theme or plugin can leave open. - -A pre-generated static site will outperform caching plugins, allowing you to serve at local speeds to users around the world. - -[**https://wp2static.com**](https://wp2static.com/) - -Not compatible with WooCommerce or membership sites, but solutions like [Snipcart](https://snipcart.com) allow for eCommerce on static websites. - -= Features = - - * publishes a standalone, static html copy of your whole WordPress website - * removes tell-tale signs your site is running WordPress, making it unattractive to hackers - * auto-deploy to a folder on your server, a ZIP file, FTP server, S3, GitHub, Netlif, BunnyCDN, BitBucket or GitLab - * schedule unattended exports via the WP Crontrol plugin or by hitting the custom hook - * desktop notifications alert you to when exports are complete - - -= Benefits = - - * protects you from malicious attacks/malware - * speeds up your site by not hitting the database or executing any PHP code - * allows you to host your site for free on GitHub Pages, Netlify or the free tier of AWS S3, Azure, etc - * allows you to deploy to crazy fast hosting options, like S3, behind CloudFront - * have a nice development -> staging -> production workflow and integrate with your CI tools - -= A word from the author = - -[youtube http://www.youtube.com/watch?v=HPc4JjBvkrU] - -= Who loves this? = - - - Digital Agencies with many sites to manage, no need to worry about WP/plugin updates for client sites - - Internet Marketers can create a bunch of quick sites/landing pages that load fast and are free to host - - Solo website owners and content creators who like WordPress but don't want to worry about how to secure it - - Operations people at large corporations don't often like dealing with WordPress, this allows them to close the security holes and have more control over the hosting - - Budget conscious people like free hosting (who doesn't?!?) - - Government agencies who have strict security requirements, but have users who prefer to use WordPress - * Thos who want to use it to archive an old WordPress website, keeping the content online, but not worrying about keeping WP up to date - -This plugin produces a static HTML version of your wordpress install, incredibly useful for anyone who would like the publishing power of wordpress but whose webhost doesn't allow dynamic PHP driven sites - such as GitHub Pages. You can run your development site on a different domain or offline, and the plugin will change all relevant URLs when you publish your site. It's a simple but powerful plugin, and after hitting the publish button, the plugin will output a ZIP file of your entire site, ready to upload straight to it's new home. - - -= Getting started = - -Here is the basic premise: - -You need 2 URLs of some sort (they can be on the same server, different servers, subdomains, etc). - - - 1st URL is for where you keep WP - this doesn't need to be accessible or known to anyone but you, if you're the only one working on your content - - - 2nd URL is where you'll "publish" the static version of your site to. This is likely to be your main domain (ie, http://mywordpresssite.com). - -That said, you can install the plugin and do an easy test without any other configuration. This will publish a static version to a subdirectory, such as http://mywordpresssite.com/mystatictest/. That's a good way to check the static site is publishing properly, then you can switch to another deployment option, such as FTP or GitHub Pages and deploy to your live site. - -As WordPress allows infinite customization and configurations, I don't think any plugin author would be willing to guarantee complete compatibility with every theme, plugin and custom coding on every site. But my aim is to get as high a % of people as possible able to take advantage of static hosting with their WP site. - -If you haven't read on why you may want to host statically, please have a read of this article: - -http://docs.wp2static.com/blog/how-and-why-to-host-your-wordpress-site-for-free/ - - -Developed by [**Leon Stafford**](http://leonstafford.github.io). If you have any questions about this plugin's usage, installation or development, please email me at: [help@wp2static.com](mailto:help@wp2static.com) - -== Installation == - -= via WP Admin panel = - -1. Go to Plugins > Add New -2. Search for "WP2Static" -3. Click on the Install Now button -4. Activate the plugin and find it under the Tools menu - -[Watch an installation video](https://youtu.be/kTYlohYGmBk) - -= manual installation = - -1. Upload the static-html-output directory to the `/wp-content/plugins/` directory -2. Activate the plugin through the 'Plugins' menu in WordPress -3. Access the plugin settings from the "Tools" menu - -= via WP CLI = - -1. `wp --allow-root plugin install static-html-output-plugin --activate` - - -== Frequently Asked Questions == - -= How do I configure all the options? = - -There's some useful information on the page once you select a deployment method. There are also some good tutorials linked at https://wp2static.com/ - -= Where can I publish my static site to? = - -Anywhere that allows HTML files to be uploaded, ie: - - * Any FTP server - * GitHub/GitLab/BitBucket Pages (GitHub API integration now included) - * S3 / CloudFront - * Netlify - * BunnyCDN - * Rackspace Cloud Files - -= My export failed - how do I proceed? = - -Everyone's WordPress hosting environment and configuration is unique, with different plugins, themes, PHP versions, to name a few. Whilst the plugin does its best to support all environments, sometimes you'll encounter a new issue. Sometimes we can adjust the settings in the plugin to overcome an issue, other times, it will require a bugfix and a new release of the plugin (usually a quick process). - -When you have an issue, send the contents of your "Export Log" on the plugin screen to the developer, at [help@wp2static.com](mailto:help@wp2static.com). He'll usually respond within 12 hrs, often sooner. - -== Screenshots == - -1. Deployment screen -2. Crawling options -3. Processing options -4. Advanced options -5. Help & Documentation -6. Detailed log files -7. Ways to support the plugin - -== Changelog == - -= 6.6.7 = - - * Bump readme to show supported version of WordPress 5.3 - * change header image in wp.org - * fix broken Slack link to Telegram - -= 6.6.6 = - - * Bump readme to show supported version of WordPress - -= 6.6.5 = - - * Bugfix: fix offline ZIP generation (links not being properly rewritten) - * Bugfix: fix for srcset URLs not being crawled or rewritten - * Bugfix: fixes compatibility with PHP 5.6 (but please do upgrade!) - -= 6.6.4 = - - * Bugfix: fix cases of WordPress Site URL -> placeholder rewriting - * Bugfix: fixes escaped URLs not being written to Destination URL - -= 6.6.3 = - - * Bugfix: fixes incorrect links in pagination URLs detection - * Bugfix: fixes homepage showing 404 page in some environments - * Enhancement: allow custom port to be used during crawling - -= 6.6.2 = - - * Bugfix: fix errors in S3 deployments. Ensure you delete your Deploy Cache (Advanced tab), then re-run your deploy with version 6.6.2. - -= 6.6.1 = - - * Bugfix: fix for Excluded URLs; log exclusion rules for Debug Mode (thanks @yadex205!) - * Bugfix: fix for malformed URLs returned in Detected URLs - -= 6.6 = - - * Enhancement: Crawl Delay added to overcome "Too many files" issue on certain hosting environments - * Bugfix: S3 files with @ in pathname (quick fix, in lieu of a comprehensive fix for extended/foreign characters) - * Bugfix: forcing of https rewriting when site contains http links when serving over https - * Bugfix: Detected URLs returning some paths with double //'s within - * Change: plugin directory structure cleaned up - -= 6.5.3 = - - * Bugfix: filter URLs with spaces from initial crawl list - -= 6.5.1 = - - * Bugfix: fixes exports where homepage is 404 - -= 6.5 = - - * Enhancement: pagination URLs for all post types now included in initial crawl - * Enhancement: pagination URLs for taxonomies, comments now included in initial crawl - * Bugfix: posts and page URLs weren't all being detected - -= 6.4 = - - * New feature: Debug Mode - helps diagnose any errors causing the plugin to fail - * Enhancement: Improvements to URL rewriting engine - * Enhancement: Set unique user-agent while crawling site - * Bugfix: Allow uploads to S3 buckets with dots in bucket name - * Bugfix: Detect Webpack-built themes' dist directory - * Bugfix: Fix false-positives in deploy tests - * Bugfix: Fix error with WP-CLI options commands - -= 6.3 = - - * New feature: incremental deploys for all but Netlify (cache unchanged files to speed up deploys) - * New feature: Post-deploy hook, allowing users to trigger their own scripts after deploy - * New feature: Additional URLs filter, allowing users to hook into plugin from their own code to manipulate the intial crawl list - * Enhancement: PowerPack / all deploy methods now available in the free version. - * Enhancement: progress bars now show during all compatible deploy methods - * Enhancement: reduced plugin size/overhead by using custom code over 3rd party libraries - * Enhancement: simplified CloudFront invalidation process (behind the scenes) - * Enhancement: cURL requests replace Guzzle library for less bloat (behind the scenes) - * Bugfix: BunnyCDN cache purging working properly (Storage & Pull Zone keys required) - * Bugfix: email notification on deploy now working for browser based deploys (previously only WP-CLI deploys would trigger it if selected) - * Bugfix: support Unicode chars in source HTML (thanks @dimobelov!) - * Bugfix: fix Additional URLs not being crawled - * Bugfix: choosing 'Everything' in WP URL detection really gets everything - * Bugfix: protocol relative URLs being properly replace in HTML files - * Bugfix: ignore Base HREF and relative URL settings when creating offline ZIP - -= 6.2 = - - * New feature: choose your WordPress URL detection level (Crawl settings) - * New feature: diff-based deploys for GitHub (PowerPack only) - * Enhancement: New deployment method for GitHub (PowerPack only) - * Enhancement: Progress-bar showing long-running task % complete (partial rollout) - * Enhancement: Sticky footer for plugin controls (first iteration, not pretty yet) - * Enhancement: Plugin download size reduced - * Bugfix: Non HTML/CSS files not being properly written in export (proper fix for what should have been reoslved in last version) - * Bugfix: Fix for detected WP theme URLs being malformed - * Dropped: No longer creating symlinks to last export directory - -= 6.1.3 = - - * Bugfix: JS files not being properly written in export - -= 6.1.2 = - - * Bugfix: JS files not being properly written in export - -= 6.1.1 = - - * Bugfix: Cachebust to ensure latest ZIP download link - * Bugfix: Fix issue preventing certain 3rd party deploys (PowerPack only) - -= 6.1 = - - * Bugfix: Site URLs without trailing slash weren't rewritten - -= 6.0 = - - * New feature: WP CLI integration - * New feature: auto-deploy to Bitbucket - * New feature: auto-deploy to GitLab - * New feature: send email upon completion - * New feature: exclude URLs from being crawled/exported - * New feature: initial support for feeds/xml exporting - * Enhancement: much improved export speeds via batching requests - * Enhancement: test external deploy settings before starting export - * Enhancement: flexible URL rewriting and directory renaming - * Enhancement: preview initial crawl list before starting your export - * Enhancement: support sleeping between GitHub API requests, avoid rate limits - * Enhancement: support multiple site ID formats within Netlify deploy - * Enhancement: remove Freemius SDK from free version - * Enhancement: scheduled CRON deploys now in the free version - * Enhancement: detect Elementor, copy FontAwesome to archive - * Enhancement: easy access to export/deploy logs from Logs tab - * Enhancement: strip WP's noindex,follow meta tag - * Enhancement: support Netlify _headers and _redirects files - * Enhancement: support Yoast SEO sitemaps - * Bugfix: Support for Bedrock, Debian & non-standard WP paths - * Bugfix: Prevent rewriting mailto: links containing domain - * Bugfix: Prevent rewriting URLs on external domains - * Bugfix: Offline ZIP creation now functioning properly - * Bugfix: Fix ZIP download button not always appearing - * Bugfix: Ignore certificate errors when crawling - * Drop feature: diff-based deploys (now possible via WP-CLI) - * Drop feature: deploy to Dropbox (they don't love static sites anymore) - * Plugin name change to WP2Static - -= 5.8 = - - * Bugfix: Allow activation (with warning) for PHP < 5.4 users - -= 5.7 = - - * Bugfix: Allow for WPMU/network site activation - * Bugfix: Include gallery files for NextGEN Gallery - -= 5.6 = - - * Bugfix: Major bug preventing certain files being crawled has been fixed - * Improvement: Partial support for WPMU/network site activation - -= 5.5.1 = - - * Improvement: Deploy times reduced by ~ 30%, amount of data transferred by client minimized - * Improvement: Diff-based deploys to only copy changed files (for folder, S3 and FTP deployments only) - * Improvement: Don't block other plugin usage if ZIP extension is not available - * Improvement: UX - 1-click same-server deployments; defaults to same-server for new installs - * Improvement: De-cluttered UI - -= 5.4.2 = - - * Bugfix: include all nested directories when building initial list to crawl - -= 5.4.1 = - - * Bugfix: missing library for GitHub Pages export in free version - -= 5.4 = - - * Improvement: more deployment options included (Netlify, GitHub Pages) - * Bugfix: certain cases where inline style images are written with incorrect filenames - * Bugfix: fix for cron-scheduled exports failing - * Bugfix: offline copy not rewriting home URLs - -= 5.3 = - - * Bugfix: subdir WP installations not exporting properly - * Improvement: cleaner UI for first export - -= 5.2 = - - * Support for latest WordPress 4.9.8 - * Plugin name change to WP Static Site Generator - -= 5.1 = - - * Enhancement: improved accessibility of plugin menu - -= 5.0 = - - * Major bugfixes - must update - * fixes issues preventing deployments on certain hosting environments - -= 4.4 = - - * Enhancement: More feedback on export errors with troubleshooting tips - * Enhancement: Updated Frequently Asked Questions - -= 4.3 = - - * Bugfix: fix cases where exported site is placed in site root - -= 4.2 = - - * New feature: support for relative URLs with base href - -= 4.1 = - - * New feature: deploy directly to a folder on the current server - * Improvement: FTP deployments included in the free forever version - * Bugfix: fix for rewriting escaped URLs within JavaScript for some themes - * Bugfix: fix for subdomains being duplicated during rewriting - -= 4.0 = - - * Improvement: simplified UI for easier usage - * Improvement: livechat from within plugin for easier support (during support hours) - * Improvement: basic auth setting available for free users - * Improvement: ability to reset plugin to default settings - * Bugfix: fix from crawling prematurely ending when empty files encountered - -= 3.1 = - - * Bugfix: fix certain CloudFront exceptions not being caught/logged - * Bugfix: previous exports being included in deployments in some cases - * Bugfix: issue preventing Dropbox deployments from working - * Bugfix: enable S3 deploys to all regions - * Bugfix: allow crawling local/self-cert SSL sites - * Improvement: Dropbox export done incrementally to support shared hosting environments - * Improvement: allow setting a subfolder within your S3 bucket to deploy to - * Improvement: minimized number of files from plugin for faster install times - * Improvement: allow crawling basic auth protected sites - -= 3.0 = - - * Bugfix: fix certain CloudFront exceptions not being caught/logged - -= 2.9 = - - * Bugfix: critical fix for exported directories not being rewritten - -= 2.8 = - - * Bugfix: critical fix for Dropbox, BunnyCDN and Netlify exports - -= 2.7 = - - * Bugfix: Fixes major issue where a failed first export blocked subsequent ones unless page was refreshed - * Bugfix: Plugin was not respecting the Output Directory Override - -= 2.6.4 = - - * Improvement: Reduced plugin download size from 4+ MB to about 0.8MB - * Improvement: Streamlined S3 and CloudFront export codes not to require massive AWS SDK - * Improvement: Add check for cURL extension and add more help to system requirements page - * Improvement: Make UI cleaner; place export button above Export Log;call to action on n exports - * Bugfix: Remove message about deleting ZIP when none has been created - -= 2.6.3 = - - * Bugfix: Reduced plugin download size and fix missing libraries needed for export - -= 2.6.2 = - - * Improvement: Reduced plugin total ZIP size to allow installation for limited hosts - -= 2.6.1 = - - * Bugfix: Fix CloudFront Cache Invalidation and update to latest AWS SDK V3.6.13 - * Bugfix: allow crawling sites served via SSL / HTTPS - * Bugfix: prevent PHP warnings in error_log for unlink and renaming files - check they exist first - * Bugfix: correctly determine WP root in filesystem - * Improvement: allow FTP active mode, not just passive - * Improvement: add Osaka endpoint for S3 - * Improvement: include more information in Export Log to help debug - -= 2.6 = - - * Feature: Remove all traces of WordPress from your site - improve your SEO/SEM - * Feature: Include all of your uploads folder by default - ensures all files are exported - * Improvement: Streamlined interface for less clutter - * Improvement: Cleanup export folder upon completion - no more filling up your uploads dir - * Improvement: Make ZIP creation an optional step - not everyone needs to create ZIPs! - * Bugfix: Respect custom output folder setting - * Bugfix: Strip query strings from extracted URLs - * Bugfix: Use base uploads dir for export folder - no more digging around for your export folder - -= 2.5 = - - * Under the hood improvements, increasing stability and performance of the plugin. - -= 2.4 = - - * Feature: Export to BunnyCDN - a very cheap and quick static site hosting option - * Bugfix: Extracts relative URLs like fonts, background images, etc linked from your theme's CSS files - -= 2.3 = - - * Feature: Scheduled exports via WP Crontrol - * Bugfix: FTP export now works on shared/limited hosting - * Bugfix: Extracts all URLs when crawling your website's HTML files - * Bugfix: Subsequent exports correctly show realtime progress in log - -= 2.2 = - - * Bugfix: GitHub export now works on shared/limited hosting - * Feature: Realtime export progress logs - -= 2.1 = - - * Bugfix: don't hang on failures - * Bugfix: fix option to retain files on server after export - * Feature: 1-click publishing to a Netlify static site - * Feature: view server log on failure - - -= 2.0 = - -Critical bug fixes and a shiny new feature! - - * Bugfix: Dropbox export once again working after they killed version 1 of their API - * Bugfix: Amazon S3 publishing fixed after bug introduced in 1.9 - * Feature: 1-click publishing to a GitHub Pages static site - -Thanks to a user donation for funding the development work to get GitHub Pages exporting added as a new feature. I was also able to merge some recently contributed code from @patrickdk77, fixing the recent issues with AWS S3 and CloudFront. Finally, I couldn't make a new release without fixing the Dropbox export functionality - unbeknowst to me, they had killed version 1 of their API in September, breaking the functionality in this plugin, along with many other apps. - -= 1.9 = - - * Bugfix: Plugin now works on PHP 5.3 - -Though this is no longer an officially supported PHP version, many of this plugin's users are running PHP 5.3 or earlier. This fix should once again allow them to use the plugin, which has not been possible for them since about version 1.2. If you are one of these affected users, please now upgrade and enjoy all the new useful features! - -= 1.8 = - - * Bugfix: improved URL rewriting - -Plugin now ensures that formatted versions of your site's URL, ie //mydomain.com or http:\/\/mydomain.com\/ or the https/http equivalent are detected and rewritten to your target Base URL. The rewriting should now also work within CSS and JavaScript files. - -= 1.7 = - - * Bugfix: index.html contents empty for some users' themes/setups - * Bugfix: remove PHP short open tags for better compatibility - -= 1.6 = - - * Additional URLs now work again! Much needed bugfix. - -= 1.5 = - - * bugfix for Dropbox export function not exporting all files - -= 1.4 = - - * add Dropbox export option - * fix bug some users encountered with 1.3 release - -= 1.3 = - - * reduce plugin download size - -= 1.2.2 = - - * supports Amazon Web Service's S3 as an export option - -= 1.2.1 = - - * unlimited export targets - * desktop notifications alert you when all exports are completed (no more staring at the screen) - -= 1.2.0 = - - * 1-click generation and exporting to an FTP server - * improved user experience when saving and exporting sites (no more white screen of boredom!) - -= 1.1.3 = - -* Now able to choose whether to strip unneeded meta tags from generated source code. -* Improved layout for config/export screen. -* Better feedback to user when system requirements are not met - -= 1.1.2 = - -* Version bump for supporting latest WP (4.7) - -= 1.1.1 = - -Added Features - -* Updated author URL - -Removed Features - -* Premium options for One-Click publishing to provided hosting and domain - -= 1.1.0 = - -Added Features - -* Premium options for One-Click publishing to provided hosting and domain - -= 1.0.9 = - -Added Features - -* Japanese localization added (ja_UTF) - -= 1.0.8 = - -Added Features - -* long-awaited FTP transfer option integrated with basic functionality -* option to save generated static HTML files on server - -= 1.0.7 = - -Fixed bug introduced with previous version. Applied following modifications contributed by Brian Coca (https://github.com/bcoca): - -Added Features - -* zip is now written atomically (write tmp file first, then rename to zip) which now allows polling scripts to only deal with completed zip file. -* username and blog id are now part of the file name. For auditing and handling -multi site exports. - -Bug fixes - -* . and .. special directory entries are now ignored -* dirname is checked before access avoiding uninitialized warning - -= 1.0.6 = - -Added shortcut to Settings page with Plugin Action Links - -= 1.0.5 = - -Added link to relevant Settings page when permalinks structure is not set. - -= 1.0.4 = - -Added a timeout value to URL request which was breaking for slow sites - -= 1.0.3 = - -Altered main codebase to fix recursion bug and endless loop. Essential upgrade. - -= 1.0.2 = - -Initial release to Wordpress community - -== Upgrade Notice == - -= 6.6.5 = - - * Bugfix: fix offline ZIP generation (links not being properly rewritten) - * Bugfix: fix for srcset URLs not being crawled or rewritten - * Bugfix: fixes compatibility with PHP 5.6 (but please do upgrade!) - -= 6.6.4 = - - * Bugfix: fix cases of WordPress Site URL -> placeholder rewriting - * Bugfix: fixes escaped URLs not being written to Destination URL - -= 6.6.3 = - - * Bugfix: fixes incorrect links in pagination URLs detection - * Bugfix: fixes homepage showing 404 page in some environments - * Enhancement: allow custom port to be used during crawling - -= 6.6.2 = - - * Bugfix: fix errors in S3 deployments. Ensure you delete your Deploy Cache (Advanced tab), then re-run your deploy with version 6.6.2. - -= 6.6.1 = - - * Bugfix: fix for Excluded URLs; log exclusion rules for Debug Mode (thanks @yadex205!) - * Bugfix: fix for malformed URLs returned in Detected URLs - -= 6.6 = - - * Enhancement: Crawl Delay added to overcome "Too many files" issue on certain hosting environments - * Bugfix: S3 files with @ in pathname (quick fix, in lieu of a comprehensive fix for extended/foreign characters) - * Bugfix: forcing of https rewriting when site contains http links when serving over https - * Bugfix: Detected URLs returning some paths with double //'s within - * Change: plugin directory structure cleaned up - -= 6.5.3 = - - * Bugfix: filter URLs with spaces from initial crawl list - -= 6.5.1 = - - * Bugfix: fixes exports where homepage is 404 - -= 6.5 = - - * Enhancement: pagination URLs for all post types now included in initial crawl - * Enhancement: pagination URLs for taxonomies, comments now included in initial crawl - * Bugfix: posts and page URLs weren't all being detected - -= 6.4 = - - * New feature: Debug Mode - helps diagnose any errors causing the plugin to fail - * Enhancement: Improvements to URL rewriting engine - * Enhancement: Set unique user-agent while crawling site - * Bugfix: Allow uploads to S3 buckets with dots in bucket name - * Bugfix: Detect Webpack-built themes' dist directory - * Bugfix: Fix false-positives in deploy tests - * Bugfix: Fix error with WP-CLI options commands - -= 6.3 = - - * New feature: incremental deploys for all but Netlify (cache unchanged files to speed up deploys) - * New feature: Post-deploy hook, allowing users to trigger their own scripts after deploy - * New feature: Additional URLs filter, allowing users to hook into plugin from their own code to manipulate the intial crawl list - * Enhancement: PowerPack / all deploy methods now available in the free version. - * Enhancement: progress bars now show during all compatible deploy methods - * Enhancement: reduced plugin size/overhead by using custom code over 3rd party libraries - * Enhancement: simplified CloudFront invalidation process (behind the scenes) - * Enhancement: cURL requests replace Guzzle library for less bloat (behind the scenes) - * Bugfix: BunnyCDN cache purging working properly (Storage & Pull Zone keys required) - * Bugfix: email notification on deploy now working for browser based deploys (previously only WP-CLI deploys would trigger it if selected) - * Bugfix: support Unicode chars in source HTML (thanks @dimobelov!) - * Bugfix: fix Additional URLs not being crawled - * Bugfix: choosing 'Everything' in WP URL detection really gets everything - * Bugfix: protocol relative URLs being properly replace in HTML files - * Bugfix: ignore Base HREF and relative URL settings when creating offline ZIP - -= 6.2 = - - * New feature: choose your WordPress URL detection level (Crawl settings) - * New feature: diff-based deploys for GitHub (PowerPack only) - * Enhancement: New deployment method for GitHub (PowerPack only) - * Enhancement: Progress-bar showing long-running task % complete (partial rollout) - * Enhancement: Sticky footer for plugin controls (first iteration, not pretty yet) - * Enhancement: Plugin download size reduced - * Bugfix: Non HTML/CSS files not being properly written in export (proper fix for what should have been reoslved in last version) - * Bugfix: Fix for detected WP theme URLs being malformed - * Dropped: No longer creating symlinks to last export directory - -= 6.1.3 = - - * Bugfix: JS files not being properly written in export - -= 6.1.2 = - - * Bugfix: JS files not being properly written in export - -= 6.1.1 = - - * Bugfix: Cachebust to ensure latest ZIP download link - * Bugfix: Fix issue preventing certain 3rd party deploys (PowerPack only) - -= 6.1 = - - * Bugfix: Site URLs without trailing slash weren't rewritten - -= 6.0 = - - * New feature: WP CLI integration - * New feature: auto-deploy to Bitbucket - * New feature: auto-deploy to GitLab - * New feature: send email upon completion - * New feature: exclude URLs from being crawled/exported - * New feature: initial support for feeds/xml exporting - * Enhancement: much improved export speeds via batching requests - * Enhancement: test external deploy settings before starting export - * Enhancement: flexible URL rewriting and directory renaming - * Enhancement: preview initial crawl list before starting your export - * Enhancement: support sleeping between GitHub API requests, avoid rate limits - * Enhancement: support multiple site ID formats within Netlify deploy - * Enhancement: remove Freemius SDK from free version - * Enhancement: scheduled CRON deploys now in the free version - * Enhancement: detect Elementor, copy FontAwesome to archive - * Enhancement: easy access to export/deploy logs from Logs tab - * Enhancement: strip WP's noindex,follow meta tag - * Enhancement: support Netlify _headers and _redirects files - * Enhancement: support Yoast SEO sitemaps - * Bugfix: Support for Bedrock, Debian & non-standard WP paths - * Bugfix: Prevent rewriting mailto: links containing domain - * Bugfix: Prevent rewriting URLs on external domains - * Bugfix: Offline ZIP creation now functioning properly - * Bugfix: Fix ZIP download button not always appearing - * Bugfix: Ignore certificate errors when crawling - * Drop feature: diff-based deploys (now possible via WP-CLI) - * Drop feature: deploy to Dropbox (they don't love static sites anymore) - * Plugin name change to WP2Static - -= 5.8 = - - * Bugfix: Allow activation (with warning) for PHP < 5.4 users - -= 5.7 = - - * Bugfix: Allow for WPMU/network site activation - * Bugfix: Include gallery files for NextGEN Gallery - -= 5.6 = - - * Bugfix: Major bug preventing certain files being crawled has been fixed - * Improvement: Partial support for WPMU/network site activation - -= 5.5.1 = - - * Improvement: Deploy times reduced by ~ 30%, amount of data transferred by client minimized - * Improvement: Diff-based deploys to only copy changed files (for folder, S3 and FTP deployments only) - * Improvement: Don't block other plugin usage if ZIP extension is not available - * Improvement: UX - 1-click same-server deployments; defaults to same-server for new installs - * Improvement: De-cluttered UI - -= 5.4.2 = - - * Bugfix: include all nested directories when building initial list to crawl - -= 5.4.1 = - - * Bugfix: missing library for GitHub Pages export in free version - -= 5.4 = - - * Improvement: more deployment options included (Netlify, GitHub Pages) - * Bugfix: certain cases where inline style images are written with incorrect filenames - * Bugfix: fix for cron-scheduled exports failing - * Bugfix: offline copy not rewriting home URLs - -= 5.3 = - - * Bugfix: subdir WP installations not exporting properly - * Improvement: cleaner UI for first export - -= 5.2 = - - * Support for latest WordPress 4.9.8 - * Plugin name change to WP Static Site Generator - -= 5.1 = - - * Enhancement: improved accessibility of plugin menu - -= 5.0 = - - * Major bugfixes - must update - * fixes issues preventing deployments on certain hosting environments - -= 4.4 = - - * Enhancement: More feedback on export errors with troubleshooting tips - * Enhancement: Updated Frequently Asked Questions - -= 4.3 = - - * Bugfix: fix cases where exported site is placed in site root - -= 4.2 = - - * New feature: support for relative URLs with base href - -= 4.1 = - - * New feature: deploy directly to a folder on the current server - * Improvement: FTP deployments included in the free forever version - * Bugfix: fix for rewriting escaped URLs within JavaScript for some themes - * Bugfix: fix for subdomains being duplicated during rewriting - -= 4.0 = - -Major upgrade recommended for all users. Adds new functionality and fixes a major bug. - - * Improvement: simplified UI for easier usage - * Improvement: livechat from within plugin for easier support (during support hours) - * Improvement: basic auth setting available for free users - * Improvement: ability to reset plugin to default settings - * Bugfix: fix from crawling prematurely ending when empty files encountered - -= 3.1 = - -Critical upgrade with bugfixes and improvements - - * Bugfix: fix certain CloudFront exceptions not being caught/logged - * Bugfix: previous exports being included in deployments in some cases - * Bugfix: issue preventing Dropbox deployments from working - * Bugfix: enable S3 deploys to all regions - * Bugfix: allow crawling local/self-cert SSL sites - * Improvement: Dropbox export done incrementally to support shared hosting environments - * Improvement: allow setting a subfolder within your S3 bucket to deploy to - * Improvement: minimized number of files from plugin for faster install times - * Improvement: allow crawling basic auth protected sites - -= 3.0 = - - * Bugfix: fix certain CloudFront exceptions not being caught/logged - -= 2.9 = - - * Bugfix: critical fix for exported directories not being rewritten - -= 2.8 = - -Critical upgrade - recommended for all users. If you have troubles upgrading, please contact the developer at help@wp2static.com for assistance. - - * Bugfix: critical fix for Dropbox, BunnyCDN and Netlify exports - -= 2.7 = - -Critical upgrade - recommended for all users. If you have troubles upgrading, please contact the developer at help@wp2static.com for assistance. - - * Bugfix: Fixes major issue where a failed first export blocked subsequent ones unless page was refreshed - * Bugfix: Plugin was not respecting the Output Directory Override - -= 2.6.4 = - -Non-critical update - get some UI and exporting improvements and a minor bug fix - - * Improvement: Reduced plugin download size from 4+ MB to about 0.8MB - * Improvement: Streamlined S3 and CloudFront export codes not to require massive AWS SDK - * Improvement: Add check for cURL extension and add more help to system requirements page - * Improvement: Make UI cleaner; place export button above Export Log;call to action on n exports - * Bugfix: Remove message about deleting ZIP when none has been created - -= 2.6.3 = - -Critical update - fixes issues blocking installation/export for some users. - - * Bugfix: Reduced plugin download size and fix missing libraries needed for export - -= 2.6.2 = - -Important fix for those users trying to upgrade to a recent version of the plugin. The reduced filesize of this version should allow installs where others where failing. - - * Improvement: Reduced plugin total ZIP size to allow installation for limited hosts - -= 2.6.1 = - -Minor release - fixes some minor issues discovered in V2.6, brings some improvements. Recommeneded to upgrade for increased stability with your exports and an easier time troubleshooting when something goes wrong. - - * Bugfix: Fix CloudFront Cache Invalidation and update to latest AWS SDK V3.6.13 - * Bugfix: allow crawling sites served via SSL / HTTPS - * Bugfix: prevent PHP warnings in error_log for unlink and renaming files - check they exist first - * Bugfix: correctly determine WP root in filesystem - * Improvement: allow FTP active mode, not just passive - * Improvement: add Osaka endpoint for S3 - * Improvement: include more information in Export Log to help debug - -= 2.6 = - -Important upgrade, bringing a killer new feature, nice improvements and important bugfixes: - - * Feature: Remove all traces of WordPress from your site - improve your SEO/SEM - * Feature: Include all of your uploads folder by default - ensures all files are exported - * Improvement: Streamlined interface for less clutter - * Improvement: Cleanup export folder upon completion - no more filling up your uploads dir - * Improvement: Make ZIP creation an optional step - not everyone needs to create ZIPs! - * Bugfix: Respect custom output folder setting - * Bugfix: Strip query strings from extracted URLs - * Bugfix: Use base uploads dir for export folder - no more digging around for your export folder - -= 2.5 = - - * Under the hood improvements, increasing stability and performance of the plugin. - -= 2.4 = - -All the important bits from the 2.3 release, plus: - - * Feature: Export to BunnyCDN - a very cheap and quick static site hosting option - * Bugfix: Extracts relative URLs like fonts, background images, etc linked from your theme's CSS files - -= 2.3 = - -Important upgrade - critical bugfixes and new features. As we hit the 100,000 alltime downloads mark, there are big things in the pipeline coming in the major 3.0 release. Get the latest 2.3 version for a marked improvement to the plugin! - - * Feature: Scheduled exports via WP Crontrol - * Bugfix: FTP export now works on shared/limited hosting - * Bugfix: Extracts all URLs when crawling your website's HTML files - * Bugfix: Subsequent exports correctly show realtime progress in log - -= 2.2 = - -Important upgrade - bug fix and better error reporting. Recommended for all users. - - * Bugfix: GitHub export now works on shared/limited hosting - * Feature: Realtime export progress logs - -Recommended upgrade for all users. Exporting from shared hosting has been improved. Better ability to debug issues and get help when an export is failing. - -= 2.1 = - - * Bugfix: don't hang on failures - * Bugfix: fix option to retain files on server after export - * Feature: 1-click publishing to a Netlify static site - * Feature: view server log on failure - -= 2.0 = - -Critical bug fixes and a shiny new feature! - - * Bugfix: Dropbox export once again working after they killed version 1 of their API - * Bugfix: Amazon S3 publishing fixed after bug introduced in 1.9 - * Feature: 1-click publishing to a GitHub Pages static site - -Thanks to a user donation for funding the development work to get GitHub Pages exporting added as a new feature. I was also able to merge some recently contributed code from @patrickdk77, fixing the recent issues with AWS S3 and CloudFront. Finally, I couldn't make a new release without fixing the Dropbox export functionality - unbeknowst to me, they had killed version 1 of their API in September, breaking the functionality in this plugin, along with many other apps. - -Please contact me to report any bugs or request new features. Thanks again for your support of this plugin! - -= 1.9 = - -Critical update for many users~! - - * Bugfix: Plugin now works on PHP 5.3 - -Though this is no longer an officially supported PHP version, many of this plugin's users are running PHP 5.3 or earlier. This fix should once again allow them to use the plugin, which has not been possible for them since about version 1.2. If you are one of these affected users, please now upgrade and enjoy all the new useful features! - -= 1.8 = - - * Bugfix: improved URL rewriting - -Plugin now ensures that formatted versions of your site's URL, ie //mydomain.com or http:\/\/mydomain.com\/ or the https/http equivalent are detected and rewritten to your target Base URL. The rewriting should now also work within CSS and JavaScript files. - -= 1.7 = - - * Bugfix: index.html contents empty for some users' themes/setups - * Bugfix: remove PHP short open tags for better compatibility - -= 1.6 = - - * Additional URLs now work again! Much needed bugfix. Recommended upgrade. - -= 1.5 = - - * bugfix for Dropbox export function not exporting all files - -= 1.4 = - - * add Dropbox export option - * fix bug some users encountered with 1.3 release - -= 1.3 = - -From this update on, will only do major point increases, ie 1.3, 1.4, vs 1.3.1, 1.3.2. This is due to way WP plugin directory only reports usage stats across major version numbers. - - * reduce plugin download size - -= 1.2.2 = - - * supports Amazon Web Service's S3 as an export option - -= 1.2.1 = - -This update brings much desired multiple export targets. Please note, it will need you to enter your settings again as the guts of the plugin changed quite a bit and a settings migration didn't make the cut. - - * unlimited export targets - * desktop notifications alert you when all exports are completed (no more staring at the screen) - -= 1.2.0 = - -Good to be back into developing the plugin again. This release brings some good functionality, though may be some bugs. - - * 1-click generation and exporting to an FTP server - * improved user experience when saving and exporting sites (no more white screen of boredom!) - -= 1.1.2 = - -Minor version bump after compatibility checking with latest WordPress (4.7). - -= 1.1.0 = -Premium VIP subscription option added, providing static optimized hosting and a domain for your website. diff --git a/wp-content/plugins/static-html-output-plugin/views/bitbucket_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/bitbucket_settings_block.phtml deleted file mode 100644 index 184cd81..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/bitbucket_settings_block.phtml +++ /dev/null @@ -1,58 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/bunnycdn_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/bunnycdn_settings_block.phtml deleted file mode 100644 index 772845e..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/bunnycdn_settings_block.phtml +++ /dev/null @@ -1,64 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/folder_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/folder_settings_block.phtml deleted file mode 100644 index 0fe656d..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/folder_settings_block.phtml +++ /dev/null @@ -1,44 +0,0 @@ - -
- - - - - - - - - - - - - - - - -
- - - displayTextfield($this, 'baseUrl-folder', 'http://mystaticsite.com', '', ''); ?>
- -

Set this to the URL your visitors will use to access your site.

- -
- - -
- -

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.

- -

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 .wp2static_safety inside. You can write to any existing, populated directories, by placing a file named as such within.

-
- - - - - -

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 .wp2static_safety file within.

-
- -
diff --git a/wp-content/plugins/static-html-output-plugin/views/ftp_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/ftp_settings_block.phtml deleted file mode 100644 index 04dba92..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/ftp_settings_block.phtml +++ /dev/null @@ -1,82 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/github_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/github_settings_block.phtml deleted file mode 100644 index a2893b6..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/github_settings_block.phtml +++ /dev/null @@ -1,66 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/gitlab_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/gitlab_settings_block.phtml deleted file mode 100644 index f8f91b4..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/gitlab_settings_block.phtml +++ /dev/null @@ -1,56 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/message.phtml b/wp-content/plugins/static-html-output-plugin/views/message.phtml deleted file mode 100644 index 49ba392..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/message.phtml +++ /dev/null @@ -1,17 +0,0 @@ - - -
-

message; ?>

- -
- - exportLog) && count($this->exportLog)): ?> -

Export Log

-
exportLog)) ?>
- diff --git a/wp-content/plugins/static-html-output-plugin/views/netlify_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/netlify_settings_block.phtml deleted file mode 100644 index a48510c..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/netlify_settings_block.phtml +++ /dev/null @@ -1,59 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/options-page-js.phtml b/wp-content/plugins/static-html-output-plugin/views/options-page-js.phtml deleted file mode 100644 index 3304672..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/options-page-js.phtml +++ /dev/null @@ -1,1256 +0,0 @@ - - diff --git a/wp-content/plugins/static-html-output-plugin/views/options-page.phtml b/wp-content/plugins/static-html-output-plugin/views/options-page.phtml deleted file mode 100644 index d07d8ba..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/options-page.phtml +++ /dev/null @@ -1,174 +0,0 @@ - - -
- - -
-

Outdated PHP version detected

-

The current officially supported PHP versions can be found on PHP.net

- -

Whilst the plugin tries to work on the most common PHP environments, it currently requires PHP 5.4 or higher.

- -

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.

For help on upgrading your environment, please join our support community at https://wp2static.com/community/

- -

Your current PHP version is:

-
- - - - - wp_site->uploads_writable ) : ?> - -
-

Your uploads directory is not writable

-

Please ensure that wp_site->wp_uploads_path; ?> - is writable by your webserver. -

-
- - - - wp_site->curl_enabled ) : ?> - -
-

You need the cURL extension enabled on your web server

-

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 forum.

-
- - - - wp_site->permalinks_set ) : ?> - -
-

You need to set your WordPress Pemalinks

- -

Due to the nature of how static sites work, you'll need to have some kind of permalinks structure defined in your Permalink Settings within WordPress. To learn more on how to do this, please see WordPress's official guide to the Settings Permalinks Screen.

-
- - - - - - - -
- - - - - 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 ""; - } - } - - ?> - - - - - - - - - -
- - -
- -
- - - - - diff --git a/wp-content/plugins/static-html-output-plugin/views/s3_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/s3_settings_block.phtml deleted file mode 100644 index a2c1312..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/s3_settings_block.phtml +++ /dev/null @@ -1,112 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/tab_advanced.phtml b/wp-content/plugins/static-html-output-plugin/views/tab_advanced.phtml deleted file mode 100644 index f362479..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/tab_advanced.phtml +++ /dev/null @@ -1,139 +0,0 @@ - - diff --git a/wp-content/plugins/static-html-output-plugin/views/tab_crawling.phtml b/wp-content/plugins/static-html-output-plugin/views/tab_crawling.phtml deleted file mode 100644 index 43a5600..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/tab_crawling.phtml +++ /dev/null @@ -1,138 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/tab_export.phtml b/wp-content/plugins/static-html-output-plugin/views/tab_export.phtml deleted file mode 100644 index 3a8e1ee..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/tab_export.phtml +++ /dev/null @@ -1,47 +0,0 @@ -
- - - - - - - - - -
- - - -
- - - - - - - - - -
- diff --git a/wp-content/plugins/static-html-output-plugin/views/tab_help.phtml b/wp-content/plugins/static-html-output-plugin/views/tab_help.phtml deleted file mode 100644 index ce3c89e..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/tab_help.phtml +++ /dev/null @@ -1,67 +0,0 @@ - - diff --git a/wp-content/plugins/static-html-output-plugin/views/tab_logs.phtml b/wp-content/plugins/static-html-output-plugin/views/tab_logs.phtml deleted file mode 100644 index 20ebe18..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/tab_logs.phtml +++ /dev/null @@ -1,30 +0,0 @@ - - diff --git a/wp-content/plugins/static-html-output-plugin/views/tab_love.phtml b/wp-content/plugins/static-html-output-plugin/views/tab_love.phtml deleted file mode 100644 index 3a700dc..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/tab_love.phtml +++ /dev/null @@ -1,81 +0,0 @@ - - diff --git a/wp-content/plugins/static-html-output-plugin/views/tab_processing.phtml b/wp-content/plugins/static-html-output-plugin/views/tab_processing.phtml deleted file mode 100644 index 8246ebd..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/tab_processing.phtml +++ /dev/null @@ -1,109 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/views/zip_settings_block.phtml b/wp-content/plugins/static-html-output-plugin/views/zip_settings_block.phtml deleted file mode 100644 index e5a4bb4..0000000 --- a/wp-content/plugins/static-html-output-plugin/views/zip_settings_block.phtml +++ /dev/null @@ -1,46 +0,0 @@ - diff --git a/wp-content/plugins/static-html-output-plugin/wp2static.css b/wp-content/plugins/static-html-output-plugin/wp2static.css deleted file mode 100644 index f216c2c..0000000 --- a/wp-content/plugins/static-html-output-plugin/wp2static.css +++ /dev/null @@ -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; -} diff --git a/wp-content/plugins/static-html-output-plugin/wp2static.php b/wp-content/plugins/static-html-output-plugin/wp2static.php deleted file mode 100644 index a1fe31a..0000000 --- a/wp-content/plugins/static-html-output-plugin/wp2static.php +++ /dev/null @@ -1,98 +0,0 @@ -' . __( 'Settings', 'static-html-output-plugin' ) . ''; - 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 '

Publish whole site as static HTML

'; - echo ""; -} - -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'; -}