当前位置: 首页>>代码示例>>PHP>>正文


PHP MainWP_Utility::getMainWPDir方法代码示例

本文整理汇总了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);
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:10,代码来源:class-mainwp-logger.php

示例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;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:42,代码来源:class-mainwp-system.php

示例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>';
 }
开发者ID:senlin,项目名称:mainwp,代码行数:30,代码来源:view-mainwp-manage-sites-view.php

示例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);
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:25,代码来源:page-mainwp-server-information.php

示例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));
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:51,代码来源:page-mainwp-install-bulk.php

示例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)));
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:8,代码来源:class-mainwp-utility.php


注:本文中的MainWP_Utility::getMainWPDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。