mirror of
https://ghproxy.net/https://github.com/elementor/wp2static.git
synced 2025-09-09 00:37:56 +08:00
rm svn cruft
This commit is contained in:
parent
35fb98a9ee
commit
5137819b19
16 changed files with 0 additions and 1126 deletions
|
@ -1,23 +0,0 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 58
|
||||
/!svn/ver/584068/static-html-output-plugin/trunk/languages
|
||||
END
|
||||
static-html-output-plugin.pot
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 88
|
||||
/!svn/ver/584068/static-html-output-plugin/trunk/languages/static-html-output-plugin.pot
|
||||
END
|
||||
static-html-output-plugin-ja_UTF.po
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 94
|
||||
/!svn/ver/584068/static-html-output-plugin/trunk/languages/static-html-output-plugin-ja_UTF.po
|
||||
END
|
||||
static-html-output-plugin-ja_UTF.mo
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 94
|
||||
/!svn/ver/584068/static-html-output-plugin/trunk/languages/static-html-output-plugin-ja_UTF.mo
|
||||
END
|
|
@ -1,130 +0,0 @@
|
|||
10
|
||||
|
||||
dir
|
||||
1562315
|
||||
https://plugins.svn.wordpress.org/static-html-output-plugin/trunk/languages
|
||||
https://plugins.svn.wordpress.org
|
||||
|
||||
|
||||
|
||||
2012-08-10T22:07:20.140116Z
|
||||
584068
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
b8457f37-d9ea-0310-8a92-e5e31aec5664
|
||||
|
||||
static-html-output-plugin-ja_UTF.mo
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:41:42.036128Z
|
||||
b86bf77cccf9e1aa413eb652d83061f0
|
||||
2012-08-10T22:07:20.140116Z
|
||||
584068
|
||||
leonstafford
|
||||
has-props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1757
|
||||
|
||||
static-html-output-plugin.pot
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:41:42.040128Z
|
||||
a8ca8a9636ea982c4a9f6fb6027c5e7f
|
||||
2012-08-10T22:07:20.140116Z
|
||||
584068
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
553
|
||||
|
||||
static-html-output-plugin-ja_UTF.po
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:41:42.036128Z
|
||||
d5ba944c0475d05705986c414bf03550
|
||||
2012-08-10T22:07:20.140116Z
|
||||
584068
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2209
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
K 13
|
||||
svn:mime-type
|
||||
V 24
|
||||
application/octet-stream
|
||||
END
|
Binary file not shown.
|
@ -1,74 +0,0 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WP Static HTML Output Plugin\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-08-11 05:47+0800\n"
|
||||
"PO-Revision-Date: 2012-08-11 05:48+0800\n"
|
||||
"Last-Translator: Leon Stafford <leon.stafford@mac.com>\n"
|
||||
"Language-Team: Leon Stafford <leon.stafford@mac.com>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-Language: Japanese\n"
|
||||
"X-Poedit-Country: JAPAN\n"
|
||||
"X-Poedit-SearchPath-0: ..\n"
|
||||
|
||||
#: ../wp-static-html-output.php:30
|
||||
msgid "Settings"
|
||||
msgstr "設定"
|
||||
|
||||
#: ../library/StaticHtmlOutput.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のリモートパス"
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
# Copyright (C) 2012
|
||||
# This file is distributed under the same license as the package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/static-html-output-plugin\n"
|
||||
"POT-Creation-Date: 2012-08-10 20:50:49+00:00\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
#: wp-static-html-output.php:29
|
||||
msgid "Settings"
|
||||
msgstr ""
|
|
@ -1,17 +0,0 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 57
|
||||
/!svn/ver/1562315/static-html-output-plugin/trunk/library
|
||||
END
|
||||
.htaccess
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 66
|
||||
/!svn/ver/367876/static-html-output-plugin/trunk/library/.htaccess
|
||||
END
|
||||
StaticHtmlOutput.php
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 78
|
||||
/!svn/ver/1562315/static-html-output-plugin/trunk/library/StaticHtmlOutput.php
|
||||
END
|
|
@ -1,102 +0,0 @@
|
|||
10
|
||||
|
||||
dir
|
||||
1562315
|
||||
https://plugins.svn.wordpress.org/static-html-output-plugin/trunk/library
|
||||
https://plugins.svn.wordpress.org
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:47:45.108813Z
|
||||
1562315
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
b8457f37-d9ea-0310-8a92-e5e31aec5664
|
||||
|
||||
.htaccess
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:41:42.260142Z
|
||||
b1f3a1d4f59592d580e08bdab2c411a0
|
||||
2011-04-01T11:50:21.434284Z
|
||||
367876
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
31
|
||||
|
||||
StaticHtmlOutput
|
||||
dir
|
||||
|
||||
StaticHtmlOutput.php
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:45:49.596534Z
|
||||
7c4271bb4b22b95338854ed77dc5cd73
|
||||
2016-12-27T00:47:45.108813Z
|
||||
1562315
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12213
|
||||
|
||||
FTP
|
||||
dir
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
Order deny,allow
|
||||
Deny from all
|
|
@ -1,434 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package WP Static HTML Output
|
||||
*
|
||||
* Copyright (c) 2011 Leon Stafford
|
||||
*/
|
||||
|
||||
/**
|
||||
* WP Static HTML Output Plugin
|
||||
*/
|
||||
class StaticHtmlOutput
|
||||
{
|
||||
/**
|
||||
* Plugin version
|
||||
*/
|
||||
const VERSION = '1.1.2';
|
||||
|
||||
/**
|
||||
* The lookup key used to locate the options record in the wp_options table
|
||||
*/
|
||||
const OPTIONS_KEY = 'wp-static-html-output-options';
|
||||
|
||||
/**
|
||||
* The hook used in all actions and filters
|
||||
*/
|
||||
const HOOK = 'wp-static-html-output';
|
||||
|
||||
/**
|
||||
* Singleton instance
|
||||
* @var StaticHtmlOutput
|
||||
*/
|
||||
protected static $_instance = null;
|
||||
|
||||
/**
|
||||
* An instance of the options structure containing all options for this plugin
|
||||
* @var StaticHtmlOutput_Options
|
||||
*/
|
||||
protected $_options = null;
|
||||
|
||||
/**
|
||||
* View object
|
||||
* @var StaticHtmlOutput_View
|
||||
*/
|
||||
protected $_view = null;
|
||||
|
||||
/**
|
||||
* Export log (list of processed urls)
|
||||
* @var array
|
||||
*/
|
||||
protected $_exportLog = array();
|
||||
|
||||
/**
|
||||
* Singleton pattern implementation makes "new" unavailable
|
||||
* @return void
|
||||
*/
|
||||
protected function __construct()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Singleton pattern implementation makes "clone" unavailable
|
||||
* @return void
|
||||
*/
|
||||
protected function __clone()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Returns an instance of WP Static HTML Output Plugin
|
||||
* Singleton pattern implementation
|
||||
* @return StaticHtmlOutput
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (null === self::$_instance)
|
||||
{
|
||||
self::$_instance = new self();
|
||||
self::$_instance->_options = new StaticHtmlOutput_Options(self::OPTIONS_KEY);
|
||||
self::$_instance->_view = new StaticHtmlOutput_View();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes singleton instance and assigns hooks callbacks
|
||||
* @param string $bootstrapFile
|
||||
* @return StaticHtmlOutput
|
||||
*/
|
||||
public static function init($bootstrapFile)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
|
||||
// Activation
|
||||
register_activation_hook($bootstrapFile, array($instance, 'activate'));
|
||||
|
||||
// Backend hooks and action callbacks
|
||||
if (is_admin())
|
||||
{
|
||||
add_action('admin_menu', array($instance, 'registerOptionsPage'));
|
||||
add_action(self::HOOK . '-saveOptions', array($instance, 'saveOptions'));
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs activation
|
||||
* @return void
|
||||
*/
|
||||
public function activate()
|
||||
{
|
||||
// Not installed?
|
||||
if (null === $this->_options->getOption('version'))
|
||||
{
|
||||
$this->_options
|
||||
->setOption('version', self::VERSION)
|
||||
->setOption('baseUrl', home_url())
|
||||
->setOption('additionalUrls', '')
|
||||
->setOption('generateZip', '')
|
||||
->setOption('retainStaticFiles', '')
|
||||
->setOption('sendViaFTP', '')
|
||||
->setOption('ftpServer', '')
|
||||
->setOption('ftpUsername', '')
|
||||
->setOption('ftpPassword', '')
|
||||
->setOption('ftpRemotePath', '')
|
||||
->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds menu navigation items for this plugin
|
||||
* @return void
|
||||
*/
|
||||
public function registerOptionsPage()
|
||||
{
|
||||
$page = add_submenu_page('tools.php', __('WP Static HTML Output', 'static-html-output-plugin'), __('WP Static HTML Output', 'static-html-output-plugin'), 'manage_options', self::HOOK . '-options', array($this, 'renderOptionsPage'));
|
||||
add_action('admin_print_styles-' . $page, array($this, 'enqueueAdminStyles'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues CSS files required for this plugin
|
||||
* @return void
|
||||
*/
|
||||
public function enqueueAdminStyles()
|
||||
{
|
||||
$pluginDirUrl = plugin_dir_url(dirname(__FILE__));
|
||||
wp_enqueue_style(self::HOOK . '-admin', $pluginDirUrl . '/css/wp-static-html-output.css');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the general options page.
|
||||
* Fires saveOptions action hook.
|
||||
* @return void
|
||||
*/
|
||||
public function renderOptionsPage()
|
||||
{
|
||||
// Check system requirements
|
||||
$uploadDir = wp_upload_dir();
|
||||
$uploadsFolderWritable = $uploadDir && is_writable($uploadDir['path']);
|
||||
$supportsZipArchives = extension_loaded('zip');
|
||||
$permalinksStructureDefined = strlen(get_option('permalink_structure'));
|
||||
|
||||
if (!$uploadsFolderWritable || !$supportsZipArchives ||!$permalinksStructureDefined)
|
||||
{
|
||||
$this->_view
|
||||
->setTemplate('system-requirements')
|
||||
->assign('uploadsFolderWritable', $uploadsFolderWritable)
|
||||
->assign('supportsZipArchives', $supportsZipArchives)
|
||||
->assign('permalinksStructureDefined', $permalinksStructureDefined)
|
||||
->render();
|
||||
}
|
||||
else
|
||||
{
|
||||
do_action(self::HOOK . '-saveOptions');
|
||||
|
||||
$this->_view
|
||||
->setTemplate('options-page')
|
||||
->assign('exportLog', $this->_exportLog)
|
||||
->assign('baseUrl', $this->_options->getOption('baseUrl'))
|
||||
->assign('additionalUrls', $this->_options->getOption('additionalUrls'))
|
||||
->assign('generateZip', $this->_options->getOption('generateZip'))
|
||||
->assign('retainStaticFiles', $this->_options->getOption('retainStaticFiles'))
|
||||
->assign('sendViaFTP', $this->_options->getOption('sendViaFTP'))
|
||||
->assign('ftpServer', $this->_options->getOption('ftpServer'))
|
||||
->assign('ftpUsername', $this->_options->getOption('ftpUsername'))
|
||||
->assign('ftpRemotePath', $this->_options->getOption('ftpRemotePath'))
|
||||
->assign('onceAction', self::HOOK . '-options')
|
||||
->render();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the options
|
||||
* @return void
|
||||
*/
|
||||
public function saveOptions()
|
||||
{
|
||||
// Protection
|
||||
if (!isset($_POST['action']) || 'generate' != $_POST['action'])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_admin_referer(self::HOOK . '-options') || !current_user_can('manage_options'))
|
||||
{
|
||||
exit('You cannot change WP Static HTML Output Plugin options.');
|
||||
}
|
||||
|
||||
// Save options
|
||||
$this->_options
|
||||
->setOption('baseUrl', filter_input(INPUT_POST, 'baseUrl', FILTER_SANITIZE_URL))
|
||||
->setOption('additionalUrls', filter_input(INPUT_POST, 'additionalUrls'))
|
||||
->setOption('generateZip', filter_input(INPUT_POST, 'generateZip'))
|
||||
->setOption('retainStaticFiles', filter_input(INPUT_POST, 'retainStaticFiles'))
|
||||
->setOption('sendViaFTP', filter_input(INPUT_POST, 'sendViaFTP'))
|
||||
->setOption('ftpServer', filter_input(INPUT_POST, 'ftpServer'))
|
||||
->setOption('ftpUsername', filter_input(INPUT_POST, 'ftpUsername'))
|
||||
->setOption('ftpRemotePath', filter_input(INPUT_POST, 'ftpRemotePath'))
|
||||
->save();
|
||||
|
||||
// Generate archive
|
||||
$archiveUrl = $this->_generateArchive();
|
||||
|
||||
// Render the message
|
||||
if (is_wp_error($archiveUrl))
|
||||
{
|
||||
$message = 'Error: ' . $archiveUrl->get_error_code;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = sprintf('Archive created successfully: <a href="%s">Download archive</a>', $archiveUrl);
|
||||
if ($this->_options->getOption('retainStaticFiles') == 1)
|
||||
{
|
||||
$message .= sprintf('<br />Static files retained at: %s/', str_replace(home_url(),'',substr($archiveUrl,0,-4)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->_view->setTemplate('message')
|
||||
->assign('message', $message)
|
||||
->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates ZIP archive
|
||||
* @return string|WP_Error
|
||||
*/
|
||||
protected function _generateArchive()
|
||||
{
|
||||
global $blog_id;
|
||||
set_time_limit(0);
|
||||
|
||||
// Prepare archive directory
|
||||
$uploadDir = wp_upload_dir();
|
||||
$exporter = wp_get_current_user();
|
||||
$archiveName = $uploadDir['path'] . '/' . self::HOOK . '-' . $blog_id . '-' . time() . '-' . $exporter->user_login;
|
||||
$archiveDir = $archiveName . '/';
|
||||
if (!file_exists($archiveDir))
|
||||
{
|
||||
wp_mkdir_p($archiveDir);
|
||||
}
|
||||
|
||||
// Prepare queue
|
||||
$baseUrl = untrailingslashit(home_url());
|
||||
$newBaseUrl = untrailingslashit($this->_options->getOption('baseUrl'));
|
||||
$urlsQueue = array_unique(array_merge(
|
||||
array(trailingslashit($baseUrl)),
|
||||
$this->_getListOfLocalFilesByUrl(array(get_template_directory_uri())),
|
||||
$this->_getListOfLocalFilesByUrl(explode("\n", $this->_options->getOption('additionalUrls')))
|
||||
));
|
||||
|
||||
// Process queue
|
||||
$this->_exportLog = array();
|
||||
while (count($urlsQueue))
|
||||
{
|
||||
$currentUrl = array_shift($urlsQueue);
|
||||
|
||||
//echo "Processing ". $currentUrl."<br />";
|
||||
|
||||
$urlResponse = new StaticHtmlOutput_UrlRequest($currentUrl);
|
||||
$urlResponse->cleanup();
|
||||
|
||||
// Add current url to the list of processed urls
|
||||
$this->_exportLog[$currentUrl] = true;
|
||||
|
||||
|
||||
// Add new urls to the queue
|
||||
|
||||
foreach ($urlResponse->extractAllUrls($baseUrl) as $newUrl)
|
||||
{
|
||||
if (!isset($this->_exportLog[$newUrl]) && $newUrl != $currentUrl && !in_array($newUrl,$urlsQueue))
|
||||
{
|
||||
//echo "Adding ".$newUrl." to the list<br />";
|
||||
$urlsQueue[] = $newUrl;
|
||||
}
|
||||
}
|
||||
|
||||
// Save url data
|
||||
$urlResponse->replaceBaseUlr($baseUrl, $newBaseUrl);
|
||||
$this->_saveUrlData($urlResponse, $archiveDir);
|
||||
|
||||
}
|
||||
|
||||
// Create archive object
|
||||
$tempZip = $archiveName . '.tmp';
|
||||
$zipArchive = new ZipArchive();
|
||||
if ($zipArchive->open($tempZip, ZIPARCHIVE::CREATE) !== true)
|
||||
{
|
||||
return new WP_Error('Could not create archive');
|
||||
}
|
||||
|
||||
|
||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($archiveDir));
|
||||
foreach ($iterator as $fileName => $fileObject)
|
||||
{
|
||||
|
||||
$baseName = basename($fileName);
|
||||
if($baseName != '.' && $baseName != '..')
|
||||
{
|
||||
if (!$zipArchive->addFile(realpath($fileName), str_replace($archiveDir, '', $fileName)))
|
||||
{
|
||||
return new WP_Error('Could not add file: ' . $fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$zipArchive->close();
|
||||
rename($tempZip, $archiveName . '.zip');
|
||||
|
||||
if($this->_options->getOption('sendViaFTP') == 1)
|
||||
{
|
||||
|
||||
//crude FTP addition
|
||||
require_once '/home/leon/leonwp/wp-content/plugins/static-html-output-plugin/library/FTP/ftp.php';
|
||||
$config = array();//keys[passive_mode(true|false)|transfer_mode(FTP_ASCII|FTP_BINARY)|reattempts(int)|log_path|verbose(true|false)|create_mask(default:0777)]
|
||||
$ftp = new ftp($config);
|
||||
$ftp->conn($this->_options->getOption('ftpServer'), $this->_options->getOption('ftpUsername'), filter_input(INPUT_POST, 'ftpPassword'));
|
||||
|
||||
//Crude FTP
|
||||
$ftp->put($this->_options->getOption('ftpRemotePath'), $archiveName . '/');
|
||||
|
||||
unset($ftp);
|
||||
}
|
||||
|
||||
// Remove temporary files unless user requested to keep or needed for FTP transfer
|
||||
if ($this->_options->getOption('retainStaticFiles') != 1)
|
||||
{
|
||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($archiveDir), RecursiveIteratorIterator::CHILD_FIRST);
|
||||
foreach ($iterator as $fileName => $fileObject)
|
||||
{
|
||||
|
||||
// Remove file
|
||||
if ($fileObject->isDir())
|
||||
{
|
||||
// Ignore special dirs
|
||||
$dirName = basename($fileName);
|
||||
if($dirName != '.' && $dirName != '..') {
|
||||
rmdir($fileName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unlink($fileName);
|
||||
}
|
||||
}
|
||||
rmdir($archiveDir);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return str_replace(ABSPATH, trailingslashit(home_url()), $archiveName . '.zip');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of local files
|
||||
* @param array $urls
|
||||
* @return array
|
||||
*/
|
||||
protected function _getListOfLocalFilesByUrl(array $urls)
|
||||
{
|
||||
$files = array();
|
||||
|
||||
foreach ($urls as $url)
|
||||
{
|
||||
$directory = str_replace(home_url('/'), ABSPATH, $url);
|
||||
|
||||
if (stripos($url, home_url('/')) === 0 && is_dir($directory))
|
||||
{
|
||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
|
||||
foreach ($iterator as $fileName => $fileObject)
|
||||
{
|
||||
if (is_file($fileName))
|
||||
{
|
||||
$pathinfo = pathinfo($fileName);
|
||||
if (isset($pathinfo['extension']) && !in_array($pathinfo['extension'], array('php', 'phtml', 'tpl')))
|
||||
{
|
||||
array_push($files, home_url(str_replace(ABSPATH, '', $fileName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves url data in temporary archive directory
|
||||
* @param StaticHtmlOutput_UrlRequest $url
|
||||
* @param string $archiveDir
|
||||
* @return void
|
||||
*/
|
||||
protected function _saveUrlData(StaticHtmlOutput_UrlRequest $url, $archiveDir)
|
||||
{
|
||||
$urlInfo = parse_url($url->getUrl());
|
||||
$pathInfo = pathinfo(isset($urlInfo['path']) && $urlInfo['path'] != '/' ? $urlInfo['path'] : 'index.html');
|
||||
|
||||
// Prepare file directory and create it if it doesn't exist
|
||||
$fileDir = $archiveDir . (isset($pathInfo['dirname']) ? $pathInfo['dirname'] : '');
|
||||
if (empty($pathInfo['extension']) && $pathInfo['basename'] == $pathInfo['filename'])
|
||||
{
|
||||
$fileDir .= '/' . $pathInfo['basename'];
|
||||
$pathInfo['filename'] = 'index';
|
||||
}
|
||||
if (!file_exists($fileDir))
|
||||
{
|
||||
wp_mkdir_p($fileDir);
|
||||
}
|
||||
|
||||
// Prepare file name and save file contents
|
||||
$fileExtension = ($url->isHtml() || !isset($pathInfo['extension']) ? 'html' : $pathInfo['extension']);
|
||||
$fileName = $fileDir . '/' . $pathInfo['filename'] . '.' . $fileExtension;
|
||||
file_put_contents($fileName, $url->getResponseBody());
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 55
|
||||
/!svn/ver/1412768/static-html-output-plugin/trunk/views
|
||||
END
|
||||
.htaccess
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 64
|
||||
/!svn/ver/367882/static-html-output-plugin/trunk/views/.htaccess
|
||||
END
|
||||
message.phtml
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 68
|
||||
/!svn/ver/367882/static-html-output-plugin/trunk/views/message.phtml
|
||||
END
|
||||
options-page.phtml
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 74
|
||||
/!svn/ver/1412768/static-html-output-plugin/trunk/views/options-page.phtml
|
||||
END
|
||||
system-requirements.phtml
|
||||
K 25
|
||||
svn:wc:ra_dav:version-url
|
||||
V 80
|
||||
/!svn/ver/577469/static-html-output-plugin/trunk/views/system-requirements.phtml
|
||||
END
|
|
@ -1,164 +0,0 @@
|
|||
10
|
||||
|
||||
dir
|
||||
1562315
|
||||
https://plugins.svn.wordpress.org/static-html-output-plugin/trunk/views
|
||||
https://plugins.svn.wordpress.org
|
||||
|
||||
|
||||
|
||||
2016-05-09T05:07:16.436414Z
|
||||
1412768
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
b8457f37-d9ea-0310-8a92-e5e31aec5664
|
||||
|
||||
message.phtml
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:41:42.476155Z
|
||||
f6639d5e522cce1f7391d5a0a4ec2126
|
||||
2011-04-01T12:08:30.440761Z
|
||||
367882
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
177
|
||||
|
||||
options-page.phtml
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:41:42.476155Z
|
||||
30f3672a9edb47b8cd670333891dd6b7
|
||||
2016-05-09T05:07:16.436414Z
|
||||
1412768
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2450
|
||||
|
||||
system-requirements.phtml
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:41:42.476155Z
|
||||
65b63f37f5ce131a7d785f5214c3503d
|
||||
2012-07-26T03:26:17.320959Z
|
||||
577469
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1325
|
||||
|
||||
.htaccess
|
||||
file
|
||||
|
||||
|
||||
|
||||
|
||||
2016-12-27T00:41:42.476155Z
|
||||
b1f3a1d4f59592d580e08bdab2c411a0
|
||||
2011-04-01T12:08:30.440761Z
|
||||
367882
|
||||
leonstafford
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
31
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
Order deny,allow
|
||||
Deny from all
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package WP Static HTML Output
|
||||
*
|
||||
* Copyright (c) 2011 Leon Stafford
|
||||
*/
|
||||
?>
|
||||
<div class="updated fade">
|
||||
<p><strong><?php echo $this->message ?></strong></p>
|
||||
</div>
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package WP Static HTML Output
|
||||
*
|
||||
* Copyright (c) 2011 Leon Stafford
|
||||
*/
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
|
||||
<h2><?= __('WP Static HTML Output Plugin', 'static-html-output-plugin');?></h2>
|
||||
|
||||
<?php if (is_array($this->exportLog) && count($this->exportLog)): ?>
|
||||
<h3>Export Log</h3>
|
||||
<pre class="wpsho-export-log"><?php echo implode("\n", array_keys($this->exportLog)) ?></pre>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="postbox-container">
|
||||
<div class="metabox-holder">
|
||||
<div class="meta-box-sortables ui-sortable">
|
||||
|
||||
<form id="general-options" method="post" action="">
|
||||
|
||||
<div class="postbox">
|
||||
<div class="handlediv" title="Click to toggle"><br /></div>
|
||||
|
||||
<h3 class="hndle"><span><?= __('Export Options', 'static-html-output-plugin');?></span></h3>
|
||||
|
||||
<div class="inside">
|
||||
<p>
|
||||
<label for="baseUrl"><?= __('Base Url', 'static-html-output-plugin');?>:</label>
|
||||
<input type="text" id="baseUrl" name="baseUrl" value="<?php echo esc_attr($this->baseUrl) ?>" size="50" />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="additionalUrls"><?= __('Additional Urls', 'static-html-output-plugin');?>:</label>
|
||||
<textarea class="widefat" name="additionalUrls" id="additionalUrls" rows="5" cols="10"><?php echo esc_html($this->additionalUrls) ?></textarea>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input name="generateZip" id="generateZip" value="1" type="checkbox" <?php if ($this->generateZip == 1) echo "checked"; ?> />
|
||||
<label for="generateZip"><?= __('Generate Zip archive of whole site', 'static-html-output-plugin');?></label>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input name="retainStaticFiles" id="retainStaticFiles" value="1" type="checkbox" <?php if ($this->retainStaticFiles == 1) echo "checked"; ?> />
|
||||
<label for="retainStaticFiles"><?= __('Retain generated static files on server', 'static-html-output-plugin');?></label>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="submit">
|
||||
<?php wp_nonce_field($this->onceAction) ?>
|
||||
<input type="hidden" name="action" value="generate" />
|
||||
<input class="button-primary" type="submit" name="submit" value="Generate" />
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package WP Static HTML Output
|
||||
*
|
||||
* Copyright (c) 2011 Leon Stafford
|
||||
*/
|
||||
|
||||
$fail = array();
|
||||
$pass = array();
|
||||
|
||||
if (!$this->supportsZipArchives):
|
||||
$fail[] = 'You are missing the <strong>zip</strong> extension';
|
||||
else:
|
||||
$pass[] = 'You have the <strong>zip</strong> extension';
|
||||
endif;
|
||||
|
||||
if (!$this->uploadsFolderWritable):
|
||||
$fail[] = 'Your uploads folder is not writable.';
|
||||
else:
|
||||
$pass[] = 'Your uploads folder is writable';
|
||||
endif;
|
||||
|
||||
if (!$this->permalinksStructureDefined):
|
||||
$fail[] = 'Your permalinks structure is undefined. Please set your permalinks structure here: <a href="'.admin_url( 'options-permalink.php' ).'">Permalink Settings</a>';
|
||||
else:
|
||||
$pass[] = 'Your permalinks structure is ok.';
|
||||
endif;
|
||||
?>
|
||||
|
||||
<div class="wrap wpsho-report">
|
||||
|
||||
<h2>System Requirements Report</h2>
|
||||
|
||||
<p><strong>Your server does not meet the following requirements in order to use this plugin.</strong></p>
|
||||
|
||||
<p>
|
||||
The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for this plugin:
|
||||
<ul>
|
||||
<li><?php echo implode('</li><li>', $fail) ?></li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<?php if (count($pass)): ?>
|
||||
<p>
|
||||
The following requirements were successfully met:
|
||||
<ul>
|
||||
<li><?php echo implode('</li><li>', $pass) ?></li>
|
||||
</ul>
|
||||
</p>
|
||||
<?php endif ?>
|
||||
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue