本文整理汇总了PHP中MainWP_Utility::getMainWPDir方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::getMainWPDir方法的具体用法?PHP MainWP_Utility::getMainWPDir怎么用?PHP MainWP_Utility::getMainWPDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::getMainWPDir方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
private function __construct()
{
$this->logDirectory = MainWP_Utility::getMainWPDir();
$this->logDirectory = $this->logDirectory[0];
$enabled = get_option('mainwp_actionlogs');
if ($enabled === false) {
$enabled = MainWP_Logger::DISABLED;
}
$this->setLogPriority($enabled);
}
示例2: parse_init
function parse_init()
{
if (isset($_GET['do']) && $_GET['do'] == 'testLog') {
MainWP_Logger::Instance()->debug('ruben');
}
if (isset($_GET['do']) && $_GET['do'] == 'cronBackups') {
$this->mainwp_cronbackups_action();
} else {
if (isset($_GET['do']) && $_GET['do'] == 'cronBackupsContinue') {
$this->mainwp_cronbackups_continue_action();
} else {
if (isset($_GET['do']) && $_GET['do'] == 'cronStats') {
$this->mainwp_cronstats_action();
} else {
if (isset($_GET['do']) && $_GET['do'] == 'cronUpdatesCheck') {
$this->mainwp_cronupdatescheck_action();
} else {
if (isset($_GET['mwpdl']) && isset($_GET['sig'])) {
$mwpDir = MainWP_Utility::getMainWPDir();
$mwpDir = $mwpDir[0];
$file = trailingslashit($mwpDir) . rawurldecode($_REQUEST['mwpdl']);
if (stristr(rawurldecode($_REQUEST['mwpdl']), '..')) {
return;
}
if (file_exists($file) && md5(filesize($file)) == $_GET['sig']) {
$this->uploadFile($file);
exit;
}
} else {
if (isset($_GET['page'])) {
switch ($_GET['page']) {
case 'mainwp-setup':
new MainWP_Setup_Wizard();
break;
}
}
}
}
}
}
}
}
示例3: showBackups
public static function showBackups(&$website, $fullBackups, $dbBackups)
{
$output = '';
echo '<table>';
$mwpDir = MainWP_Utility::getMainWPDir();
$mwpDir = $mwpDir[0];
foreach ($fullBackups as $key => $fullBackup) {
$downloadLink = admin_url('?sig=' . md5(filesize($fullBackup)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir, '', $fullBackup)));
$output .= '<tr><td style="width: 400px;">' . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(filemtime($fullBackup))) . ' - ' . MainWP_Utility::human_filesize(filesize($fullBackup));
$output .= '</td><td><a title="' . basename($fullBackup) . '" href="' . $downloadLink . '" class="button">Download</a></td>';
$output .= '<td><a href="admin.php?page=SiteRestore&websiteid=' . $website->id . '&f=' . base64_encode($downloadLink) . '&size=' . filesize($fullBackup) . '" class="mainwp-upgrade-button button" target="_blank" title="' . basename($fullBackup) . '">Restore</a></td></tr>';
}
if ($output == '') {
echo '<br />' . __('No full backup has been taken yet', 'mainwp') . '<br />';
} else {
echo '<strong style="font-size: 14px">' . __('Last backups from your files:', 'mainwp') . '</strong>' . $output;
}
echo '</table><br/><table>';
$output = '';
foreach ($dbBackups as $key => $dbBackup) {
$downloadLink = admin_url('?sig=' . md5(filesize($dbBackup)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir, '', $dbBackup)));
$output .= '<tr><td style="width: 400px;">' . MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp(filemtime($dbBackup))) . ' - ' . MainWP_Utility::human_filesize(filesize($dbBackup)) . '</td><td><a title="' . basename($dbBackup) . '" href="' . $downloadLink . '" download class="button">Download</a></td></tr>';
}
if ($output == '') {
echo '<br />' . __('No database only backup has been taken yet', 'mainwp') . '<br /><br />';
} else {
echo '<strong style="font-size: 14px">' . __('Last backups from your database:', 'mainwp') . '</strong>' . $output;
}
echo '</table>';
}
示例4: checkDirectoryMainWPDirectory
protected static function checkDirectoryMainWPDirectory()
{
$dirs = MainWP_Utility::getMainWPDir();
$path = $dirs[0];
if (!is_dir(dirname($path))) {
//return self::renderDirectoryRow('MainWP upload directory', $path, 'Writable', 'Directory not found', false);
return self::renderDirectoryRow('MainWP Upload Directory', 'Writable', 'Not Found', false, self::ERROR);
}
$hasWPFileSystem = MainWP_Utility::getWPFilesystem();
/** @global WP_Filesystem_Base $wp_filesystem */
global $wp_filesystem;
if ($hasWPFileSystem && !empty($wp_filesystem)) {
if (!$wp_filesystem->is_writable($path)) {
//return self::renderDirectoryRow('MainWP upload directory', $path, 'Writable', 'Directory not writable', false);
return self::renderDirectoryRow('MainWP Upload Directory', 'Writable', 'Not Writable', false, self::ERROR);
}
} else {
if (!is_writable($path)) {
//return self::renderDirectoryRow('MainWP upload directory', $path, 'Writable', 'Directory not writable', false);
return self::renderDirectoryRow('MainWP Upload Directory', 'Writable', 'Not Writable', false, self::ERROR);
}
}
//return self::renderDirectoryRow('MainWP upload directory', $path, 'Writable', '/', true);
return self::renderDirectoryRow('MainWP Upload Directory', 'Writable', 'Writable', true, self::ERROR);
}
示例5: prepareInstall
public static function prepareInstall()
{
include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
if (!isset($_POST['url'])) {
if ($_POST['type'] == 'plugin') {
$api = plugins_api('plugin_information', array('slug' => $_POST['slug'], 'fields' => array('sections' => false)));
//Save on a bit of bandwidth.
} else {
$api = themes_api('theme_information', array('slug' => $_POST['slug'], 'fields' => array('sections' => false)));
//Save on a bit of bandwidth.
}
$url = $api->download_link;
} else {
$url = $_POST['url'];
$mwpDir = MainWP_Utility::getMainWPDir();
$mwpUrl = $mwpDir[1];
if (stristr($url, $mwpUrl)) {
$fullFile = $mwpDir[0] . str_replace($mwpUrl, '', $url);
$url = admin_url('?sig=' . md5(filesize($fullFile)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir[0], '', $fullFile)));
}
}
$output = array();
$output['url'] = $url;
$output['sites'] = array();
if ($_POST['selected_by'] == 'site') {
//Get sites
foreach ($_POST['selected_sites'] as $enc_id) {
$websiteid = $enc_id;
if (MainWP_Utility::ctype_digit($websiteid)) {
$website = MainWP_DB::Instance()->getWebsiteById($websiteid);
$output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name'));
}
}
} else {
//Get sites from group
foreach ($_POST['selected_groups'] as $enc_id) {
$groupid = $enc_id;
if (MainWP_Utility::ctype_digit($groupid)) {
$websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($groupid));
while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
if ($website->sync_errors != '') {
continue;
}
$output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name'));
}
@MainWP_DB::free_result($websites);
}
}
}
die(json_encode($output));
}
示例6: getDownloadUrl
public static function getDownloadUrl($what, $filename)
{
$specificDir = MainWP_Utility::getMainWPSpecificDir($what);
$mwpDir = MainWP_Utility::getMainWPDir();
$mwpDir = $mwpDir[0];
$fullFile = $specificDir . $filename;
return admin_url('?sig=' . md5(filesize($fullFile)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir, '', $fullFile)));
}