diff --git a/class/class-mainwp-backup.php b/class/class-mainwp-backup.php index 46f559e..fe08fac 100644 --- a/class/class-mainwp-backup.php +++ b/class/class-mainwp-backup.php @@ -35,7 +35,7 @@ class MainWP_Backup { $this->file_descriptors = $file_descriptors; $this->loadFilesBeforeZip = $loadFilesBeforeZip; - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = $dirs[0]; if ( ! defined( 'PCLZIP_TEMPORARY_DIR' ) ) { define( 'PCLZIP_TEMPORARY_DIR', $backupdir ); @@ -233,9 +233,9 @@ class MainWP_Backup { 'xmlrpc.php', ); foreach ( $nodes as $key => $node ) { - if ( MainWP_Helper::startsWith( $node, ABSPATH . WPINC ) ) { + if ( MainWP_Helper::starts_with( $node, ABSPATH . WPINC ) ) { unset( $nodes[ $key ] ); - } elseif ( MainWP_Helper::startsWith( $node, ABSPATH . basename( admin_url( '' ) ) ) ) { + } elseif ( MainWP_Helper::starts_with( $node, ABSPATH . basename( admin_url( '' ) ) ) ) { unset( $nodes[ $key ] ); } else { foreach ( $coreFiles as $coreFile ) { @@ -259,12 +259,12 @@ class MainWP_Backup { foreach ( $nodes as $node ) { if ( $excludenonwp && is_dir( $node ) ) { - if ( ! MainWP_Helper::startsWith( $node, WP_CONTENT_DIR ) && ! MainWP_Helper::startsWith( $node, ABSPATH . 'wp-admin' ) && ! MainWP_Helper::startsWith( $node, ABSPATH . WPINC ) ) { + if ( ! MainWP_Helper::starts_with( $node, WP_CONTENT_DIR ) && ! MainWP_Helper::starts_with( $node, ABSPATH . 'wp-admin' ) && ! MainWP_Helper::starts_with( $node, ABSPATH . WPINC ) ) { continue; } } - if ( ! MainWP_Helper::inExcludes( $excludes, str_replace( ABSPATH, '', $node ) ) ) { + if ( ! MainWP_Helper::in_excludes( $excludes, str_replace( ABSPATH, '', $node ) ) ) { if ( is_dir( $node ) ) { $this->zipAddDir( $node, $excludes ); } elseif ( is_file( $node ) ) { @@ -371,9 +371,9 @@ class MainWP_Backup { 'xmlrpc.php', ); foreach ( $nodes as $key => $node ) { - if ( MainWP_Helper::startsWith( $node, ABSPATH . WPINC ) ) { + if ( MainWP_Helper::starts_with( $node, ABSPATH . WPINC ) ) { unset( $nodes[ $key ] ); - } elseif ( MainWP_Helper::startsWith( $node, ABSPATH . basename( admin_url( '' ) ) ) ) { + } elseif ( MainWP_Helper::starts_with( $node, ABSPATH . basename( admin_url( '' ) ) ) ) { unset( $nodes[ $key ] ); } else { foreach ( $coreFiles as $coreFile ) { @@ -450,12 +450,12 @@ class MainWP_Backup { foreach ( $nodes as $node ) { if ( $excludenonwp && is_dir( $node ) ) { - if ( ! MainWP_Helper::startsWith( $node, WP_CONTENT_DIR ) && ! MainWP_Helper::startsWith( $node, ABSPATH . 'wp-admin' ) && ! MainWP_Helper::startsWith( $node, ABSPATH . WPINC ) ) { + if ( ! MainWP_Helper::starts_with( $node, WP_CONTENT_DIR ) && ! MainWP_Helper::starts_with( $node, ABSPATH . 'wp-admin' ) && ! MainWP_Helper::starts_with( $node, ABSPATH . WPINC ) ) { continue; } } - if ( ! MainWP_Helper::inExcludes( $excludes, str_replace( ABSPATH, '', $node ) ) ) { + if ( ! MainWP_Helper::in_excludes( $excludes, str_replace( ABSPATH, '', $node ) ) ) { if ( is_dir( $node ) ) { if ( ! file_exists( str_replace( ABSPATH, $backupfolder, $node ) ) ) { mkdir( str_replace( ABSPATH, $backupfolder, $node ) ); // phpcs:ignore @@ -465,7 +465,7 @@ class MainWP_Backup { $this->copy_dir( $newnodes, $excludes, $backupfolder, $excludenonwp, false ); unset( $newnodes ); } elseif ( is_file( $node ) ) { - if ( $this->excludeZip && MainWP_Helper::endsWith( $node, '.zip' ) ) { + if ( $this->excludeZip && MainWP_Helper::ends_with( $node, '.zip' ) ) { continue; } @@ -511,9 +511,9 @@ class MainWP_Backup { 'xmlrpc.php', ); foreach ( $nodes as $key => $node ) { - if ( MainWP_Helper::startsWith( $node, ABSPATH . WPINC ) ) { + if ( MainWP_Helper::starts_with( $node, ABSPATH . WPINC ) ) { unset( $nodes[ $key ] ); - } elseif ( MainWP_Helper::startsWith( $node, ABSPATH . basename( admin_url( '' ) ) ) ) { + } elseif ( MainWP_Helper::starts_with( $node, ABSPATH . basename( admin_url( '' ) ) ) ) { unset( $nodes[ $key ] ); } else { foreach ( $coreFiles as $coreFile ) { @@ -578,7 +578,7 @@ class MainWP_Backup { continue; } - if ( ! MainWP_Helper::inExcludes( $excludes, str_replace( ABSPATH, '', $name ) ) ) { + if ( ! MainWP_Helper::in_excludes( $excludes, str_replace( ABSPATH, '', $name ) ) ) { if ( $path->isDir() ) { $this->zipAddDir( $name, $excludes ); } else { @@ -655,7 +655,7 @@ class MainWP_Backup { $this->lastRun = time(); } - if ( $this->excludeZip && MainWP_Helper::endsWith( $path, '.zip' ) ) { + if ( $this->excludeZip && MainWP_Helper::ends_with( $path, '.zip' ) ) { return false; } diff --git a/class/class-mainwp-child-back-up-buddy.php b/class/class-mainwp-child-back-up-buddy.php index a92a1dc..6a05c31 100644 --- a/class/class-mainwp-child-back-up-buddy.php +++ b/class/class-mainwp-child-back-up-buddy.php @@ -36,7 +36,7 @@ class MainWP_Child_Back_Up_Buddy { return; } - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); add_action( 'wp_ajax_mainwp_backupbuddy_download_archive', array( $this, 'download_archive' ) ); add_action( 'mainwp_child_site_stats', array( $this, 'do_site_stats' ) ); @@ -748,7 +748,7 @@ class MainWP_Child_Back_Up_Buddy { return $information; } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncBackupBuddy'] ) && $data['syncBackupBuddy'] ) { try { $information['syncBackupBuddy'] = $this->get_sync_data(); diff --git a/class/class-mainwp-child-back-up-wordpress.php b/class/class-mainwp-child-back-up-wordpress.php index ee2c7b4..ccdfe90 100644 --- a/class/class-mainwp-child-back-up-wordpress.php +++ b/class/class-mainwp-child-back-up-wordpress.php @@ -32,7 +32,7 @@ class MainWP_Child_Back_Up_Wordpress { if ( is_plugin_active( 'backupwordpress/backupwordpress.php' ) ) { $this->is_plugin_installed = true; if ( version_compare( phpversion(), '5.3', '>=' ) ) { - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); } } } @@ -150,7 +150,7 @@ class MainWP_Child_Back_Up_Wordpress { return $schedule_id; } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncBackUpWordPress'] ) && $data['syncBackUpWordPress'] ) { try { $information['syncBackUpWordPress'] = $this->get_sync_data(); diff --git a/class/class-mainwp-child-back-wp-up.php b/class/class-mainwp-child-back-wp-up.php index 5d03a1e..17bed7b 100644 --- a/class/class-mainwp-child-back-wp-up.php +++ b/class/class-mainwp-child-back-wp-up.php @@ -95,7 +95,7 @@ class MainWP_Child_Back_WP_Up { BackWPup::get_instance(); add_action( 'admin_init', array( $this, 'init_download_backup' ) ); - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); } } catch ( Exception $e ) { $this->is_backwpup_installed = false; @@ -327,7 +327,7 @@ class MainWP_Child_Back_WP_Up { } } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncBackwpupData'] ) && $data['syncBackwpupData'] ) { try { $lastbackup = MainWP_Helper::get_lasttime_backup( 'backwpup' ); diff --git a/class/class-mainwp-child-branding.php b/class/class-mainwp-child-branding.php index a8405b1..2a7d762 100644 --- a/class/class-mainwp-child-branding.php +++ b/class/class-mainwp-child-branding.php @@ -246,7 +246,7 @@ class MainWP_Child_Branding { $extra_setting['login_image'] = array(); } else { try { - $upload = $this->uploadImage( $settings['child_login_image_url'] ); + $upload = $this->upload_image( $settings['child_login_image_url'] ); if ( null !== $upload ) { $extra_setting['login_image'] = array( 'path' => $upload['path'], @@ -272,7 +272,7 @@ class MainWP_Child_Branding { $extra_setting['favico_image'] = array(); } else { try { - $upload = $this->uploadImage( $settings['child_favico_image_url'] ); + $upload = $this->upload_image( $settings['child_favico_image_url'] ); if ( null !== $upload ) { $extra_setting['favico_image'] = array( 'path' => $upload['path'], @@ -313,7 +313,7 @@ class MainWP_Child_Branding { return $information; } - public static function uploadImage( $img_url ) { + public static function upload_image( $img_url ) { include_once ABSPATH . 'wp-admin/includes/file.php'; global $mainWPChild; add_filter( 'http_request_args', array( $mainWPChild, 'http_request_reject_unsafe_urls' ), 99, 2 ); diff --git a/class/class-mainwp-child-ithemes-security.php b/class/class-mainwp-child-ithemes-security.php index 5c5b0ad..aefc27b 100644 --- a/class/class-mainwp-child-ithemes-security.php +++ b/class/class-mainwp-child-ithemes-security.php @@ -36,10 +36,10 @@ class MainWP_Child_IThemes_Security { return; } - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( is_array( $data ) && isset( $data['ithemeExtActivated'] ) && ( 'yes' === $data['ithemeExtActivated'] ) ) { try { $information['syncIThemeData'] = array( diff --git a/class/class-mainwp-child-links-checker.php b/class/class-mainwp-child-links-checker.php index afc0d77..750259d 100644 --- a/class/class-mainwp-child-links-checker.php +++ b/class/class-mainwp-child-links-checker.php @@ -34,7 +34,7 @@ class MainWP_Child_Links_Checker { return; } - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); } public function action() { @@ -204,7 +204,7 @@ class MainWP_Child_Links_Checker { return $information; } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncBrokenLinksCheckerData'] ) && $data['syncBrokenLinksCheckerData'] ) { try { $information['syncBrokenLinksCheckerData'] = $this->get_sync_data(); diff --git a/class/class-mainwp-child-pagespeed.php b/class/class-mainwp-child-pagespeed.php index e6a6975..03f6144 100644 --- a/class/class-mainwp-child-pagespeed.php +++ b/class/class-mainwp-child-pagespeed.php @@ -37,7 +37,7 @@ class MainWP_Child_Pagespeed { return; } - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); add_action( 'mainwp_child_deactivation', array( $this, 'child_deactivation' ) ); } @@ -275,7 +275,7 @@ class MainWP_Child_Pagespeed { return $information; } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncPageSpeedData'] ) && $data['syncPageSpeedData'] ) { try { $information['syncPageSpeedData'] = $this->get_sync_data(); diff --git a/class/class-mainwp-child-server-information.php b/class/class-mainwp-child-server-information.php index 7ac5a1b..a7e4d4c 100644 --- a/class/class-mainwp-child-server-information.php +++ b/class/class-mainwp-child-server-information.php @@ -10,12 +10,12 @@ class MainWP_Child_Server_Information { 'wp_ajax_mainwp-child_dismiss_warnings', array( 'MainWP_Child_Server_Information', - 'dismissWarnings', + 'dismiss_warnings', ) ); } - public static function dismissWarnings() { + public static function dismiss_warnings() { if ( isset( $_POST['what'] ) ) { $dismissWarnings = get_option( 'mainwp_child_dismiss_warnings' ); if ( ! is_array( $dismissWarnings ) ) { @@ -589,7 +589,7 @@ class MainWP_Child_Server_Information { self::renderRowSec( 'cURL Extension Enabled', '=', true, 'getCurlSupport', '', '', null, '', null, self::ERROR ); self::renderRowSec( 'cURL Timeout', '>=', '300', 'getCurlTimeout', 'seconds', '=', '0' ); if ( function_exists( 'curl_version' ) ) { - self::renderRowSec( 'cURL Version', '>=', '7.18.1', 'getCurlVersion', '', '', null ); + self::renderRowSec( 'cURL Version', '>=', '7.18.1', 'get_curl_version', '', '', null ); self::renderRowSec( 'cURL SSL Version', '>=', @@ -597,7 +597,7 @@ class MainWP_Child_Server_Information { 'version_number' => 0x009080cf, 'version' => 'OpenSSL/0.9.8l', ), - 'getCurlSSLVersion', + 'get_curl_ssl_version', '', '', null, @@ -760,7 +760,7 @@ class MainWP_Child_Server_Information {
'; $updraftplus->log_e( 'Restore successful!' ); echo '
'; @@ -3322,7 +3322,7 @@ ENDHERE; } } - private function rebuildBackupHistory( $remotescan = false ) { + private function rebuild_backup_history( $remotescan = false ) { global $updraftplus_admin, $updraftplus; $messages = null; if ( method_exists( $updraftplus, 'rebuild_backup_history' ) ) { @@ -3334,7 +3334,7 @@ ENDHERE; return $messages; } - private function forceScheduledResumption() { + private function force_scheduled_resumption() { global $updraftplus; // Casting $resumption to int is absolutely necessary, as the WP cron system uses a hashed serialisation of the parameters for identifying jobs. Different type => different hash => does not match. $resumption = (int) $_REQUEST['resumption']; diff --git a/class/class-mainwp-child-wordfence.php b/class/class-mainwp-child-wordfence.php index 3c6d38e..63e41d6 100644 --- a/class/class-mainwp-child-wordfence.php +++ b/class/class-mainwp-child-wordfence.php @@ -190,7 +190,7 @@ class MainWP_Child_Wordfence { } if ( $this->is_wordfence_installed ) { - add_action( 'wp_ajax_mainwp_wordfence_download_htaccess', array( $this, 'downloadHtaccess' ) ); + add_action( 'wp_ajax_mainwp_wordfence_download_htaccess', array( $this, 'download_htaccess' ) ); } } @@ -222,10 +222,10 @@ class MainWP_Child_Wordfence { $information = $this->kill_scan(); break; case 'requestScan': - $information = $this->requestScan(); + $information = $this->request_scan(); break; case 'killScan': - $information = $this->killScan(); + $information = $this->kill_scan(); break; case 'set_showhide': $information = $this->set_showhide(); @@ -240,10 +240,10 @@ class MainWP_Child_Wordfence { $information = $this->load_issues(); break; case 'loadIssues': - $information = $this->ajax_loadIssues_callback(); + $information = $this->ajax_load_issues_callback(); break; case 'load_wafData': - $information = $this->load_wafData(); + $information = $this->load_waf_data(); break; case 'update_all_issues': $information = $this->update_all_issues(); @@ -252,7 +252,7 @@ class MainWP_Child_Wordfence { $information = $this->update_issues_status(); break; case 'updateIssueStatus': - $information = $this->updateIssueStatus(); + $information = $this->update_issue_status(); break; case 'delete_issues': $information = $this->delete_issues(); @@ -261,7 +261,7 @@ class MainWP_Child_Wordfence { $information = $this->bulk_operation(); break; case 'bulkOperation': - $information = $this->bulkOperation(); + $information = $this->bulk_operation(); break; case 'delete_file': $information = $this->delete_file(); @@ -276,10 +276,10 @@ class MainWP_Child_Wordfence { $information = $this->save_settings_new(); break; case 'saveOptions': - $information = $this->saveOptions(); + $information = $this->save_options(); break; case 'recentTraffic': - $information = $this->recentTraffic(); + $information = $this->recent_traffic(); break; case 'ticker': $information = $this->ticker(); @@ -288,22 +288,22 @@ class MainWP_Child_Wordfence { $information = $this->reverse_lookup(); break; case 'block_ip': - $information = $this->ajax_blockIP_callback(); + $information = $this->ajax_block_ip_callback(); break; case 'whois': $information = $this->whois(); break; case 'createBlock': - $information = $this->ajax_createBlock_callback(); + $information = $this->ajax_create_block_callback(); break; case 'getBlocks': - $information = $this->ajax_getBlocks_callback(); + $information = $this->ajax_get_blocks_callback(); break; case 'deleteBlocks': - $information = $this->ajax_deleteBlocks_callback(); + $information = $this->ajax_delete_blocks_callback(); break; case 'makePermanentBlocks': - $information = $this->ajax_makePermanentBlocks_callback(); + $information = $this->ajax_make_permanent_blocks_callback(); break; case 'unblock_ip': $information = $this->unblock_ip(); @@ -321,106 +321,106 @@ class MainWP_Child_Wordfence { $information = $this->export_settings(); break; case 'save_cache_config': - $information = $this->saveCacheConfig(); + $information = $this->save_cache_config(); break; case 'check_falcon_htaccess': - $information = $this->checkFalconHtaccess(); + $information = self::check_falcon_htaccess(); break; case 'checkHtaccess': - $information = $this->checkHtaccess(); + $information = $this->check_htaccess(); break; case 'save_cache_options': - $information = $this->saveCacheOptions(); + $information = $this->save_cache_options(); break; case 'clear_page_cache': - $information = $this->clearPageCache(); + $information = $this->clear_page_cache(); break; case 'get_cache_stats': - $information = $this->getCacheStats(); + $information = $this->get_cache_stats(); break; case 'add_cache_exclusion': - $information = $this->addCacheExclusion(); + $information = $this->add_cache_exclusion(); break; case 'load_cache_exclusions': - $information = $this->loadCacheExclusions(); + $information = $this->load_cache_exclusions(); break; case 'remove_cache_exclusion': - $information = $this->removeCacheExclusion(); + $information = $this->remove_cache_exclusion(); break; case 'get_diagnostics': - $information = $this->getDiagnostics(); + $information = $this->get_diagnostics(); break; case 'update_waf_rules': - $information = $this->updateWAFRules(); + $information = $this->update_waf_rules(); break; case 'update_waf_rules_new': - $information = $this->updateWAFRules_New(); + $information = $this->update_waf_rules_new(); break; case 'save_debugging_config': $information = $this->save_debugging_config(); break; case 'load_live_traffic': - $information = $this->loadLiveTraffic(); + $information = $this->load_live_traffic(); break; case 'white_list_waf': - $information = $this->whitelistWAFParamKey(); + $information = $this->whitelist_waf_param_key(); break; case 'hide_file_htaccess': - $information = $this->hideFileHtaccess(); + $information = $this->hide_file_htaccess(); break; case 'fix_fpd': - $information = $this->fixFPD(); + $information = $this->fix_fpd(); break; case 'disable_directory_listing': - $information = $this->disableDirectoryListing(); + $information = $this->disable_directory_listing(); break; case 'delete_database_option': - $information = $this->deleteDatabaseOption(); + $information = $this->delete_database_option(); break; case 'misconfigured_howget_ips_choice': - $information = $this->misconfiguredHowGetIPsChoice(); + $information = $this->mis_configured_how_get_ips_choice(); break; case 'delete_admin_user': - $information = $this->deleteAdminUser(); + $information = $this->delete_admin_user(); break; case 'revoke_admin_user': - $information = $this->revokeAdminUser(); + $information = $this->revoke_admin_user(); break; case 'clear_all_blocked': - $information = $this->clearAllBlocked(); + $information = $this->clear_all_blocked(); break; case 'permanently_block_all_ips': - $information = $this->permanentlyBlockAllIPs(); + $information = $this->permanently_block_all_ips(); break; case 'unlockout_ip': - $information = $this->unlockOutIP(); + $information = $this->unlock_out_ip(); break; case 'unblock_range': - $information = $this->unblockRange(); + $information = $this->unblock_range(); break; case 'block_ip_ua_range': - $information = $this->blockIPUARange(); + $information = $this->block_ip_ua_range(); break; case 'load_block_ranges': - $information = $this->loadBlockRanges(); + $information = $this->load_block_ranges(); break; case 'save_waf_config': - $information = $this->saveWAFConfig(); + $information = $this->save_waf_config(); break; case 'whitelist_bulk_delete': - $information = $this->whitelistBulkDelete(); + $information = $this->whitelist_bulk_delete(); break; case 'whitelist_bulk_enable': - $information = $this->whitelistBulkEnable(); + $information = $this->whitelist_bulk_enable(); break; case 'whitelist_bulk_disable': - $information = $this->whitelistBulkDisable(); + $information = $this->whitelist_bulk_disable(); break; case 'update_config': - $information = $this->updateConfig(); + $information = $this->update_config(); break; case 'save_country_blocking': - $information = $this->saveCountryBlocking(); + $information = $this->save_country_blocking(); break; } } @@ -428,7 +428,7 @@ class MainWP_Child_Wordfence { } - public static function getSectionSettings( $section ) { + public static function get_section_settings( $section ) { $general_opts = array( 'scheduleScan', 'apiKey', @@ -622,11 +622,11 @@ class MainWP_Child_Wordfence { ); } - private function requestScan() { + private function request_scan() { return wordfence::ajax_scan_callback(); } - private function killScan() { + private function kill_scan() { return wordfence::ajax_killScan_callback(); } @@ -790,11 +790,11 @@ class MainWP_Child_Wordfence { 'todayAttBlocked' => $this->count_attacks_blocked( 1 ), 'weekAttBlocked' => $this->count_attacks_blocked( 7 ), 'monthAttBlocked' => $this->count_attacks_blocked( 30 ), - 'wafData' => $this->_getWAFData(), + 'wafData' => self::get_waf_data(), ); } - public static function ajax_loadIssues_callback() { + public static function ajax_load_issues_callback() { $offset = isset( $_POST['offset'] ) ? intval( $_POST['offset'] ) : 0; $limit = isset( $_POST['limit'] ) ? intval( $_POST['limit'] ) : WORDFENCE_SCAN_ISSUES_PER_PAGE; @@ -816,9 +816,9 @@ class MainWP_Child_Wordfence { return $return; } - public function load_wafData() { + public function load_waf_data() { $return = array( - 'wafData' => $this->_getWAFData(), + 'wafData' => self::get_waf_data(), 'ip' => wfUtils::getIP(), 'ajaxWatcherDisabled_front' => (bool) wfConfig::get( 'ajaxWatcherDisabled_front' ), 'ajaxWatcherDisabled_admin' => (bool) wfConfig::get( 'ajaxWatcherDisabled_admin' ), @@ -865,7 +865,7 @@ SQL return array( 'ok' => 1 ); } - public function updateIssueStatus() { + public function update_issue_status() { $wfIssues = new wfIssues(); $status = $_POST['status']; $issueID = $_POST['id']; @@ -996,7 +996,7 @@ SQL } } - public function bulkOperation() { + public function bulk_operation() { return wordfence::ajax_bulkOperation_callback(); } @@ -1110,7 +1110,7 @@ SQL } $section = isset( $_POST['savingSection'] ) ? $_POST['savingSection'] : ''; - $saving_opts = self::getSectionSettings( $section ); + $saving_opts = self::get_section_settings( $section ); $result = array(); @@ -1361,7 +1361,7 @@ SQL return $result; } - public static function recentTraffic() { + public static function recent_traffic() { return wordfence::ajax_recentTraffic_callback(); } @@ -1671,7 +1671,7 @@ SQL return $jsonData; } - public static function loadLiveTraffic() { + public static function load_live_traffic() { $wfdb = new wfDB(); $serverTime = $wfdb->querySingle( 'select unix_timestamp()' ); $return = wordfence::ajax_loadLiveTraffic_callback(); @@ -1680,77 +1680,77 @@ SQL return $return; } - public function whitelistWAFParamKey() { + public function whitelist_waf_param_key() { $return = wordfence::ajax_whitelistWAFParamKey_callback(); return $return; } - public function hideFileHtaccess() { + public function hide_file_htaccess() { $return = wordfence::ajax_hideFileHtaccess_callback(); return $return; } - public static function fixFPD() { + public static function fix_fpd() { $return = wordfence::ajax_fixFPD_callback(); return $return; } - public static function disableDirectoryListing() { + public static function disable_directory_listing() { $return = wordfence::ajax_disableDirectoryListing_callback(); return $return; } - public static function deleteDatabaseOption() { + public static function delete_database_option() { $return = wordfence::ajax_deleteDatabaseOption_callback(); return $return; } - public static function misconfiguredHowGetIPsChoice() { + public static function mis_configured_how_get_ips_choice() { $return = wordfence::ajax_misconfiguredHowGetIPsChoice_callback(); return $return; } - public static function deleteAdminUser() { + public static function delete_admin_user() { $return = wordfence::ajax_deleteAdminUser_callback(); return $return; } - public static function revokeAdminUser() { + public static function revoke_admin_user() { $return = wordfence::ajax_revokeAdminUser_callback(); return $return; } - public static function clearAllBlocked() { + public static function clear_all_blocked() { $return = wordfence::ajax_clearAllBlocked_callback(); return $return; } - public static function permanentlyBlockAllIPs() { + public static function permanently_block_all_ips() { $return = wordfence::ajax_permanentlyBlockAllIPs_callback(); return $return; } - public static function unlockOutIP() { + public static function unlock_out_ip() { $return = wordfence::ajax_unlockOutIP_callback(); return $return; } - public static function unblockRange() { + public static function unblock_range() { $return = wordfence::ajax_unblockRange_callback(); return $return; } - public static function blockIPUARange() { + public static function block_ip_ua_range() { $return = wordfence::ajax_blockIPUARange_callback(); return $return; } - public static function loadBlockRanges() { + public static function load_block_ranges() { $return = wordfence::ajax_loadBlockRanges_callback(); return $return; } - public static function saveWAFConfig() { + public static function save_waf_config() { $return = wordfence::ajax_saveWAFConfig_callback(); if ( is_array( $return ) && isset( $return['data'] ) ) { $return['learningModeGracePeriod'] = wfWAF::getInstance()->getStorageEngine()->getConfig( 'learningModeGracePeriod' ); @@ -1758,26 +1758,26 @@ SQL return $return; } - public static function whitelistBulkDelete() { + public static function whitelist_bulk_delete() { $return = wordfence::ajax_whitelistBulkDelete_callback(); return $return; } - public static function whitelistBulkEnable() { + public static function whitelist_bulk_enable() { $return = wordfence::ajax_whitelistBulkEnable_callback(); return $return; } - public static function whitelistBulkDisable() { + public static function whitelist_bulk_disable() { $return = wordfence::ajax_whitelistBulkDisable_callback(); return $return; } - public static function updateConfig() { + public static function update_config() { $return = wordfence::ajax_updateConfig_callback(); return $return; } - private static function _getWAFData( $updated = null ) { + private static function get_waf_data( $updated = null ) { if ( ! class_exists( 'wfWAF' ) ) { return false; } @@ -1848,7 +1848,7 @@ SQL } - public function saveOptions() { + public function save_options() { $changes = json_decode( stripslashes( $_POST['changes'] ), true ); if ( ! empty( $_POST['changes'] ) && false !== $changes ) { try { @@ -1907,26 +1907,26 @@ SQL ); } - public function ajax_getBlocks_callback() { + public function ajax_get_blocks_callback() { $information = wordfence::ajax_getBlocks_callback(); return $information; } - public function ajax_createBlock_callback() { + public function ajax_create_block_callback() { return wordfence::ajax_createBlock_callback(); } - public static function ajax_deleteBlocks_callback() { + public static function ajax_delete_blocks_callback() { $information = wordfence::ajax_deleteBlocks_callback(); return $information; } - public static function ajax_makePermanentBlocks_callback() { + public static function ajax_make_permanent_blocks_callback() { $information = wordfence::ajax_makePermanentBlocks_callback(); return $information; } - public function ajax_blockIP_callback() { + public function ajax_block_ip_callback() { return wordfence::ajax_blockIP_callback(); } @@ -1942,7 +1942,7 @@ SQL } } - public static function saveCountryBlocking() { + public static function save_country_blocking() { if ( ! wfConfig::get( 'isPaid' ) ) { return array( 'error' => 'Sorry but this feature is only available for paid customers.' ); } @@ -2003,10 +2003,10 @@ SQL return $return; } - public static function saveCacheConfig() { + public static function save_cache_config() { $noEditHtaccess = '1'; if ( isset( $_POST['needToCheckFalconHtaccess'] ) && ! empty( $_POST['needToCheckFalconHtaccess'] ) ) { - $checkHtaccess = self::checkFalconHtaccess(); + $checkHtaccess = self::check_falcon_htaccess(); if ( isset( $checkHtaccess['ok'] ) ) { $noEditHtaccess = '0'; } @@ -2109,7 +2109,7 @@ SQL return array( 'errorMsg' => 'An error occurred.' ); } - public static function checkFalconHtaccess() { + public static function check_falcon_htaccess() { if ( wfUtils::isNginx() ) { return array( 'nginx' => 1 ); } @@ -2135,7 +2135,7 @@ SQL ); } - public static function checkHtaccess() { + public static function check_htaccess() { if ( wfUtils::isNginx() ) { return array( 'nginx' => 1 ); } @@ -2151,7 +2151,7 @@ SQL return array( 'ok' => 1 ); } - public static function downloadHtaccess() { + public static function download_htaccess() { if ( ! isset( $_GET['_wpnonce'] ) || empty( $_GET['_wpnonce'] ) ) { die( '-1' ); } @@ -2172,7 +2172,7 @@ SQL die(); } - public static function saveCacheOptions() { + public static function save_cache_options() { $changed = false; if ( wfConfig::get( 'allowHTTPSCaching', false ) != $_POST['allowHTTPSCaching'] ) { $changed = true; @@ -2192,7 +2192,7 @@ SQL return array( 'ok' => 1 ); } - public static function clearPageCache() { + public static function clear_page_cache() { $stats = wfCache::clearPageCache(); if ( $stats['error'] ) { $body = 'A total of ' . $stats['totalErrors'] . ' errors occurred while trying to clear your cache. The last error was: ' . $stats['error']; @@ -2213,7 +2213,7 @@ SQL ); } - public static function getCacheStats() { + public static function get_cache_stats() { $s = wfCache::getCacheStats(); if ( 0 == $s['files'] ) { return array( @@ -2258,7 +2258,7 @@ SQL ); } - public static function addCacheExclusion() { + public static function add_cache_exclusion() { $ex = wfConfig::get( 'cacheExclusions', false ); if ( $ex ) { $ex = unserialize( $ex ); @@ -2290,7 +2290,7 @@ SQL ); } - public static function loadCacheExclusions() { + public static function load_cache_exclusions() { $ex = wfConfig::get( 'cacheExclusions', false ); if ( ! $ex ) { return array( 'ex' => false ); @@ -2302,7 +2302,7 @@ SQL ); } - public static function removeCacheExclusion() { + public static function remove_cache_exclusion() { $id = $_POST['id']; $ex = wfConfig::get( 'cacheExclusions', false ); if ( ! $ex ) { @@ -2338,7 +2338,7 @@ SQL return $return; } - public function getDiagnostics() { + public function get_diagnostics() { $diagnostic = new wfDiagnostic(); $plugins = get_plugins(); @@ -3038,7 +3038,7 @@ SQL ); } - public static function updateWAFRules() { + public static function update_waf_rules() { $event = new wfWAFCronFetchRulesEvent( time() - 2 ); $event->setWaf( wfWAF::getInstance() ); $event->fire(); @@ -3049,12 +3049,12 @@ SQL ); } - public static function updateWAFRules_New() { + public static function update_waf_rules_new() { $event = new wfWAFCronFetchRulesEvent( time() - 2 ); $event->setWaf( wfWAF::getInstance() ); $success = $event->fire(); - return self::_getWAFData( $success ); + return self::get_waf_data( $success ); } public static function save_debugging_config() { diff --git a/class/class-mainwp-child-wp-rocket.php b/class/class-mainwp-child-wp-rocket.php index f5227eb..1e45c0b 100644 --- a/class/class-mainwp-child-wp-rocket.php +++ b/class/class-mainwp-child-wp-rocket.php @@ -37,7 +37,7 @@ class MainWP_Child_WP_Rocket { return; } - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); if ( 'hide' === get_option( 'mainwp_wprocket_hide_plugin' ) ) { add_filter( 'all_plugins', array( $this, 'all_plugins' ) ); @@ -123,7 +123,7 @@ class MainWP_Child_WP_Rocket { ); } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncWPRocketData'] ) && ( 'yes' === $data['syncWPRocketData'] ) ) { try { $data = array( 'rocket_boxes' => get_user_meta( $GLOBALS['current_user']->ID, 'rocket_boxes', true ) ); diff --git a/class/class-mainwp-child-wpvivid-backuprestore.php b/class/class-mainwp-child-wpvivid-backuprestore.php index 60145c7..cf1ae69 100644 --- a/class/class-mainwp-child-wpvivid-backuprestore.php +++ b/class/class-mainwp-child-wpvivid-backuprestore.php @@ -25,14 +25,14 @@ class MainWP_Child_WPvivid_BackupRestore { return; } - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); $this->public_intetface = new WPvivid_Public_Interface(); } public function init() { } - function syncOthersData( $information, $data = array() ) { + function sync_others_data( $information, $data = array() ) { try { if ( isset( $data['syncWPvividData'] ) ) { diff --git a/class/class-mainwp-child.php b/class/class-mainwp-child.php index 5bd21e9..d5af101 100644 --- a/class/class-mainwp-child.php +++ b/class/class-mainwp-child.php @@ -21,21 +21,21 @@ class MainWP_Child { private $update_version = '1.5'; private $callableFunctions = array( - 'stats' => 'getSiteStats', - 'upgrade' => 'upgradeWP', - 'newpost' => 'newPost', + 'stats' => 'get_site_stats', + 'upgrade' => 'upgrade_wp', + 'newpost' => 'new_post', 'deactivate' => 'deactivate', - 'newuser' => 'newUser', - 'newadminpassword' => 'newAdminPassword', - 'installplugintheme' => 'installPluginTheme', - 'upgradeplugintheme' => 'upgradePluginTheme', - 'upgradetranslation' => 'upgradeTranslation', + 'newuser' => 'new_user', + 'newadminpassword' => 'new_admin_password', + 'installplugintheme' => 'install_plugin_theme', + 'upgradeplugintheme' => 'upgrade_plugin_theme', + 'upgradetranslation' => 'upgrade_translation', 'backup' => 'backup', 'backup_checkpid' => 'backup_checkpid', 'cloneinfo' => 'cloneinfo', - 'security' => 'getSecurityStats', - 'securityFix' => 'doSecurityFix', - 'securityUnFix' => 'doSecurityUnFix', + 'security' => 'get_security_stats', + 'securityFix' => 'do_security_fix', + 'securityUnFix' => 'do_security_un_fix', 'post_action' => 'post_action', 'get_all_posts' => 'get_all_posts', 'comment_action' => 'comment_action', @@ -56,7 +56,7 @@ class MainWP_Child { 'get_total_ezine_post' => 'get_total_ezine_post', 'get_next_time_to_post' => 'get_next_time_to_post', 'cancel_scheduled_post' => 'cancel_scheduled_post', - 'serverInformation' => 'serverInformation', + 'serverInformation' => 'server_information', 'maintenance_site' => 'maintenance_site', 'keyword_links_action' => 'keyword_links_action', 'branding_child_plugin' => 'branding_child_plugin', @@ -64,7 +64,7 @@ class MainWP_Child { 'uploader_action' => 'uploader_action', 'wordpress_seo' => 'wordpress_seo', 'client_report' => 'client_report', - 'createBackupPoll' => 'backupPoll', + 'createBackupPoll' => 'backup_poll', 'page_speed' => 'page_speed', 'woo_com_status' => 'woo_com_status', 'links_checker' => 'links_checker', @@ -93,7 +93,7 @@ class MainWP_Child { private $FTP_ERROR = 'Failed! Please, add FTP details for automatic updates.'; private $callableFunctionsNoAuth = array( - 'stats' => 'getSiteStatsNoAuth', + 'stats' => 'get_site_stats_no_auth', ); private $posts_where_suffix; @@ -141,7 +141,7 @@ class MainWP_Child { MainWP_Helper::update_option( 'mainwp_child_plugin_version', self::$version, 'yes' ); } - $this->checkOtherAuth(); + $this->check_other_auth(); MainWP_Clone::get()->init(); MainWP_Child_Server_Information::init(); @@ -405,7 +405,7 @@ class MainWP_Child { public function admin_notice() { // Admin Notice... - if ( ! get_option( 'mainwp_child_pubkey' ) && MainWP_Helper::isAdmin() && is_admin() ) { + if ( ! get_option( 'mainwp_child_pubkey' ) && MainWP_Helper::is_admin() && is_admin() ) { $branding_opts = MainWP_Child_Branding::Instance()->get_branding_options(); $child_name = ( '' === $branding_opts['branding_preserve_title'] ) ? 'MainWP Child' : $branding_opts['branding_preserve_title']; $dashboard_name = ( '' === $branding_opts['branding_preserve_title'] ) ? 'MainWP Dashboard' : $branding_opts['branding_preserve_title'] . ' Dashboard'; @@ -459,7 +459,7 @@ class MainWP_Child { if ( 'plugin' == $type || 'theme' == $type ) { $list = isset( $_GET['list'] ) ? $_GET['list'] : ''; if ( ! empty( $list ) ) { - // to call function upgradePluginTheme(). + // to call function upgrade_plugin_theme(). $_POST['type'] = $type; $_POST['list'] = $list; @@ -471,7 +471,7 @@ class MainWP_Child { } } - public function checkOtherAuth() { + public function check_other_auth() { $auths = get_option( 'mainwp_child_auth' ); if ( ! $auths ) { @@ -491,13 +491,13 @@ class MainWP_Child { while ( isset( $auths[ $newI ] ) ) { unset( $auths[ $newI ++ ] ); } - $auths[ $this->maxHistory ] = md5( MainWP_Helper::randString( 14 ) ); + $auths[ $this->maxHistory ] = md5( MainWP_Helper::rand_string( 14 ) ); $auths['last'] = time(); MainWP_Helper::update_option( 'mainwp_child_auth', $auths, 'yes' ); } } - public function isValidAuth( $key ) { + public function is_valid_auth( $key ) { $auths = get_option( 'mainwp_child_auth' ); if ( ! $auths ) { return false; @@ -863,7 +863,7 @@ class MainWP_Child { } public function admin_init() { - if ( MainWP_Helper::isAdmin() && is_admin() ) { + if ( MainWP_Helper::is_admin() && is_admin() ) { MainWP_Clone::get()->init_ajax(); } } @@ -898,7 +898,7 @@ class MainWP_Child { public function settings() { if ( isset( $_POST['submit'] ) && isset( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'child-settings' ) ) { if ( isset( $_POST['requireUniqueSecurityId'] ) ) { - MainWP_Helper::update_option( 'mainwp_child_uniqueId', MainWP_Helper::randString( 8 ) ); + MainWP_Helper::update_option( 'mainwp_child_uniqueId', MainWP_Helper::rand_string( 8 ) ); } else { MainWP_Helper::update_option( 'mainwp_child_uniqueId', '' ); } @@ -1071,15 +1071,15 @@ class MainWP_Child { if ( ! isset( $_REQUEST['f'] ) || ( '' === $_REQUEST['f'] ) ) { return; } - if ( ! $this->isValidAuth( $_REQUEST['key'] ) ) { + if ( ! $this->is_valid_auth( $_REQUEST['key'] ) ) { return; } if ( 'dl' === $_REQUEST['cloneFunc'] ) { - $this->uploadFile( $_REQUEST['f'] ); + $this->upload_file( $_REQUEST['f'] ); exit; } elseif ( 'deleteCloneBackup' === $_POST['cloneFunc'] ) { - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = $dirs[0]; $result = glob( $backupdir . $_POST['f'] ); if ( 0 === count( $result ) ) { @@ -1089,12 +1089,12 @@ class MainWP_Child { unlink( $result[0] ); MainWP_Helper::write( array( 'result' => 'ok' ) ); } elseif ( 'createCloneBackupPoll' === $_POST['cloneFunc'] ) { - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = $dirs[0]; $result = glob( $backupdir . 'backup-' . $_POST['f'] . '-*' ); $archiveFile = false; foreach ( $result as $file ) { - if ( MainWP_Helper::isArchive( $file, 'backup-' . $_POST['f'] . '-' ) ) { + if ( MainWP_Helper::is_archive( $file, 'backup-' . $_POST['f'] . '-' ) ) { $archiveFile = $file; break; } @@ -1105,7 +1105,7 @@ class MainWP_Child { MainWP_Helper::write( array( 'size' => filesize( $archiveFile ) ) ); } elseif ( 'createCloneBackup' === $_POST['cloneFunc'] ) { - MainWP_Helper::endSession(); + MainWP_Helper::end_session(); $files = glob( WP_CONTENT_DIR . '/dbBackup*.sql' ); foreach ( $files as $file ) { @@ -1123,7 +1123,7 @@ class MainWP_Child { $includeCoreFiles = ( $wpversion !== $wp_version ); $excludes = ( isset( $_POST['exclude'] ) ? explode( ',', $_POST['exclude'] ) : array() ); $excludes[] = str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '/uploads/mainwp'; - $uploadDir = MainWP_Helper::getMainWPDir(); + $uploadDir = MainWP_Helper::get_mainwp_dir(); $uploadDir = $uploadDir[0]; $excludes[] = str_replace( ABSPATH, '', $uploadDir ); $excludes[] = str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '/object-cache.php'; @@ -1262,7 +1262,7 @@ class MainWP_Child { return; } - $this->uploadFile( $_REQUEST['fdl'], isset( $_REQUEST['foffset'] ) ? $_REQUEST['foffset'] : 0 ); + $this->upload_file( $_REQUEST['fdl'], isset( $_REQUEST['foffset'] ) ? $_REQUEST['foffset'] : 0 ); exit; } @@ -1322,7 +1322,7 @@ class MainWP_Child { if ( isset( $_POST['function'] ) && 'register' === $_POST['function'] ) { define( 'DOING_CRON', true ); self::fix_for_custom_themes(); - $this->registerSite(); + $this->register_site(); } $auth = $this->auth( isset( $_POST['mainwpsignature'] ) ? $_POST['mainwpsignature'] : '', isset( $_POST['function'] ) ? $_POST['function'] : '', isset( $_POST['nonce'] ) ? $_POST['nonce'] : '', isset( $_POST['nossl'] ) ? $_POST['nossl'] : 0 ); @@ -1526,7 +1526,7 @@ class MainWP_Child { return false; } - public function noSSLFilterFunction( $r, $url ) { + public function no_ssl_filter_function( $r, $url ) { $r['sslverify'] = false; return $r; @@ -1544,8 +1544,8 @@ class MainWP_Child { /** * Functions to support core functionality */ - public function installPluginTheme() { - $wp_filesystem = $this->getWPFilesystem(); + public function install_plugin_theme() { + $wp_filesystem = $this->get_wp_filesystem(); if ( ! isset( $_POST['type'] ) || ! isset( $_POST['url'] ) || ( 'plugin' !== $_POST['type'] && 'theme' !== $_POST['type'] ) || '' === $_POST['url'] ) { MainWP_Helper::error( __( 'Invalid request!', 'mainwp-child' ) ); @@ -1573,7 +1573,7 @@ class MainWP_Child { $ssl_verify = true; // @see wp-admin/includes/class-wp-upgrader.php if ( isset( $_POST['sslVerify'] ) && '0' === $_POST['sslVerify'] ) { - add_filter( 'http_request_args', array( &$this, 'noSSLFilterFunction' ), 99, 2 ); + add_filter( 'http_request_args', array( &$this, 'no_ssl_filter_function' ), 99, 2 ); $ssl_verify = false; } add_filter( 'http_request_args', array( &$this, 'http_request_reject_unsafe_urls' ), 99, 2 ); @@ -1590,7 +1590,7 @@ class MainWP_Child { if ( is_wp_error( $result ) ) { if ( true == $ssl_verify && strpos( $url, 'https://' ) === 0 ) { - add_filter( 'http_request_args', array( &$this, 'noSSLFilterFunction' ), 99, 2 ); + add_filter( 'http_request_args', array( &$this, 'no_ssl_filter_function' ), 99, 2 ); $ssl_verify = false; $result = $installer->run( array( @@ -1616,7 +1616,7 @@ class MainWP_Child { remove_filter( 'http_request_args', array( &$this, 'http_request_reject_unsafe_urls' ), 99, 2 ); if ( false == $ssl_verify ) { - remove_filter( 'http_request_args', array( &$this, 'noSSLFilterFunction' ), 99 ); + remove_filter( 'http_request_args', array( &$this, 'no_ssl_filter_function' ), 99 ); } $args = array( @@ -1666,9 +1666,9 @@ class MainWP_Child { } // This will upgrade WP! - public function upgradeWP() { + public function upgrade_wp() { global $wp_version; - $wp_filesystem = $this->getWPFilesystem(); + $wp_filesystem = $this->get_wp_filesystem(); $information = array(); @@ -1753,11 +1753,11 @@ class MainWP_Child { MainWP_Helper::write( $information ); } - public function upgradeTranslation() { + public function upgrade_translation() { // Prevent disable/re-enable at upgrade. define( 'DOING_CRON', true ); - MainWP_Helper::getWPFilesystem(); + MainWP_Helper::get_wp_filesystem(); include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php'; if ( file_exists( ABSPATH . '/wp-admin/includes/screen.php' ) ) { include_once ABSPATH . '/wp-admin/includes/screen.php'; @@ -1801,17 +1801,17 @@ class MainWP_Child { $information['upgrades'] = array(); // to fix error message when translations updated. } - $information['sync'] = $this->getSiteStats( array(), false ); + $information['sync'] = $this->get_site_stats( array(), false ); MainWP_Helper::write( $information ); } - public function upgradePluginTheme() { + public function upgrade_plugin_theme() { // Prevent disable/re-enable at upgrade. if ( ! defined( 'DOING_CRON' ) ) { define( 'DOING_CRON', true ); } - MainWP_Helper::getWPFilesystem(); + MainWP_Helper::get_wp_filesystem(); include_once ABSPATH . '/wp-admin/includes/class-wp-upgrader.php'; @@ -1986,7 +1986,7 @@ class MainWP_Child { $addFilterToFixUpdate_optimizePressTheme = false; if ( in_array( 'optimizePressTheme', $themes ) ) { $addFilterToFixUpdate_optimizePressTheme = true; - add_filter( 'site_transient_update_themes', array( $this, 'hookFixOptimizePressThemeUpdate' ), 99 ); + add_filter( 'site_transient_update_themes', array( $this, 'hook_fix_optimize_press_theme_update' ), 99 ); } if ( null !== $this->filterFunction ) { @@ -2025,7 +2025,7 @@ class MainWP_Child { 'site_transient_update_themes', array( $this, - 'hookFixOptimizePressThemeUpdate', + 'hook_fix_optimize_press_theme_update', ), 99 ); @@ -2117,7 +2117,7 @@ class MainWP_Child { } } } - $information['sync'] = $this->getSiteStats( array(), false ); + $information['sync'] = $this->get_site_stats( array(), false ); MainWP_Helper::write( $information ); } @@ -2169,7 +2169,7 @@ class MainWP_Child { return $_transient_data; } - public function hookFixOptimizePressThemeUpdate( $transient ) { + public function hook_fix_optimize_press_theme_update( $transient ) { if ( ! defined( 'OP_FUNC' ) ) { return $transient; } @@ -2202,7 +2202,7 @@ class MainWP_Child { } // This will register the current wp - thus generating the public key etc. - public function registerSite() { + public function register_site() { global $current_user; $information = array(); @@ -2229,7 +2229,7 @@ class MainWP_Child { } // Check SSL Requirement. - if ( ! MainWP_Helper::isSSLEnabled() && ( ! defined( 'MAINWP_ALLOW_NOSSL_CONNECT' ) || ! MAINWP_ALLOW_NOSSL_CONNECT ) ) { + if ( ! MainWP_Helper::is_ssl_enabled() && ( ! defined( 'MAINWP_ALLOW_NOSSL_CONNECT' ) || ! MAINWP_ALLOW_NOSSL_CONNECT ) ) { MainWP_Helper::error( __( 'SSL is required on the child site to set up a secure connection.', 'mainwp-child' ) ); } @@ -2249,8 +2249,8 @@ class MainWP_Child { MainWP_Helper::update_option( 'mainwp_child_server', $_POST['server'] ); // Save the public key. MainWP_Helper::update_option( 'mainwp_child_nonce', 0 ); // Save the nonce. - MainWP_Helper::update_option( 'mainwp_child_nossl', ( '-1' === $_POST['pubkey'] || ! MainWP_Helper::isSSLEnabled() ? 1 : 0 ), 'yes' ); - $information['nossl'] = ( '-1' === $_POST['pubkey'] || ! MainWP_Helper::isSSLEnabled() ? 1 : 0 ); + MainWP_Helper::update_option( 'mainwp_child_nossl', ( '-1' === $_POST['pubkey'] || ! MainWP_Helper::is_ssl_enabled() ? 1 : 0 ), 'yes' ); + $information['nossl'] = ( '-1' === $_POST['pubkey'] || ! MainWP_Helper::is_ssl_enabled() ? 1 : 0 ); if ( function_exists( 'random_bytes' ) ) { $nossl_key = random_bytes( 32 ); $nossl_key = bin2hex( $nossl_key ); @@ -2264,10 +2264,10 @@ class MainWP_Child { $information['uniqueId'] = get_option( 'mainwp_child_uniqueId', '' ); $information['user'] = $_POST['user']; - $this->getSiteStats( $information ); + $this->get_site_stats( $information ); } - public function newPost() { + public function new_post() { $new_post = maybe_unserialize( base64_decode( $_POST['new_post'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. $post_custom = maybe_unserialize( base64_decode( $_POST['post_custom'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. $post_category = rawurldecode( isset( $_POST['post_category'] ) ? base64_decode( $_POST['post_category'] ) : null ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. @@ -2284,7 +2284,7 @@ class MainWP_Child { $others['featured_image_data'] = unserialize( base64_decode( $_POST['featured_image_data'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. } - $res = MainWP_Helper::createPost( $new_post, $post_custom, $post_category, $post_featured_image, $upload_dir, $post_tags, $others ); + $res = MainWP_Helper::create_post( $new_post, $post_custom, $post_category, $post_featured_image, $upload_dir, $post_tags, $others ); if ( is_array( $res ) && isset( $res['error'] ) ) { MainWP_Helper::error( $res['error'] ); @@ -2839,7 +2839,7 @@ class MainWP_Child { } - public function newAdminPassword() { + public function new_admin_password() { $new_password = maybe_unserialize( base64_decode( $_POST['new_password'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. $user = get_user_by( 'login', $_POST['user'] ); require_once ABSPATH . WPINC . '/registration.php'; @@ -2862,7 +2862,7 @@ class MainWP_Child { MainWP_Helper::write( $information ); } - public function newUser() { + public function new_user() { $new_user = maybe_unserialize( base64_decode( $_POST['new_user'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for benign reasons. $send_password = $_POST['send_password']; if ( isset( $new_user['role'] ) ) { @@ -2911,7 +2911,7 @@ class MainWP_Child { MainWP_Helper::write( $information ); } - public function backupPoll() { + public function backup_poll() { $fileNameUID = ( isset( $_POST['fileNameUID'] ) ? $_POST['fileNameUID'] : '' ); $fileName = ( isset( $_POST['fileName'] ) ? $_POST['fileName'] : '' ); @@ -2922,12 +2922,12 @@ class MainWP_Child { $backupFile = 'backup-' . $fileNameUID . '-'; } - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = $dirs[0]; $result = glob( $backupdir . $backupFile . '*' ); $archiveFile = false; foreach ( $result as $file ) { - if ( MainWP_Helper::isArchive( $file, $backupFile, '(.*)' ) ) { + if ( MainWP_Helper::is_archive( $file, $backupFile, '(.*)' ) ) { $archiveFile = $file; break; } @@ -2940,7 +2940,7 @@ class MainWP_Child { } else { $backupFile = 'dbBackup-' . $fileNameUID . '-*.sql'; - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = $dirs[0]; $result = glob( $backupdir . $backupFile . '*' ); if ( 0 === count( $result ) ) { @@ -2959,7 +2959,7 @@ class MainWP_Child { public function backup_checkpid() { $pid = $_POST['pid']; - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = $dirs[0]; $information = array(); @@ -2967,7 +2967,7 @@ class MainWP_Child { /** @var $wp_filesystem WP_Filesystem_Base */ global $wp_filesystem; - MainWP_Helper::getWPFilesystem(); + MainWP_Helper::get_wp_filesystem(); $pidFile = trailingslashit( $backupdir ) . 'backup-' . $pid . '.pid'; $doneFile = trailingslashit( $backupdir ) . 'backup-' . $pid . '.done'; @@ -3009,20 +3009,20 @@ class MainWP_Child { $timeout = 20 * 60 * 60; set_time_limit( $timeout ); ini_set( 'max_execution_time', $timeout ); - MainWP_Helper::endSession(); + MainWP_Helper::end_session(); // Cleanup pid files! - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = trailingslashit( $dirs[0] ); /** @var $wp_filesystem WP_Filesystem_Base */ global $wp_filesystem; - MainWP_Helper::getWPFilesystem(); + MainWP_Helper::get_wp_filesystem(); $files = glob( $backupdir . '*' ); foreach ( $files as $file ) { - if ( MainWP_Helper::endsWith( $file, '/index.php' ) | MainWP_Helper::endsWith( $file, '/.htaccess' ) ) { + if ( MainWP_Helper::ends_with( $file, '/index.php' ) | MainWP_Helper::ends_with( $file, '/.htaccess' ) ) { continue; } @@ -3035,7 +3035,7 @@ class MainWP_Child { if ( 'full' === $_POST['type'] ) { $excludes = ( isset( $_POST['exclude'] ) ? explode( ',', $_POST['exclude'] ) : array() ); $excludes[] = str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '/uploads/mainwp'; - $uploadDir = MainWP_Helper::getMainWPDir(); + $uploadDir = MainWP_Helper::get_mainwp_dir(); $uploadDir = $uploadDir[0]; $excludes[] = str_replace( ABSPATH, '', $uploadDir ); $excludes[] = str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '/object-cache.php'; @@ -3137,7 +3137,7 @@ class MainWP_Child { $ext = $_POST['ext']; } - $res = $this->backupDB( $fileName, $ext ); + $res = $this->backup_db( $fileName, $ext ); if ( ! $res ) { $information['db'] = false; } else { @@ -3157,8 +3157,8 @@ class MainWP_Child { return $information; } - protected function backupDB( $fileName = '', $ext = 'zip' ) { - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + protected function backup_db( $fileName = '', $ext = 'zip' ) { + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $dir = $dirs[0]; $timestamp = time(); @@ -3190,7 +3190,7 @@ class MainWP_Child { ); } - public function doSecurityFix() { + public function do_security_fix() { $sync = false; if ( 'all' === $_POST['feature'] ) { $sync = true; @@ -3262,12 +3262,12 @@ class MainWP_Child { MainWP_Helper::update_option( 'mainwp_security', $security, 'yes' ); if ( $sync ) { - $information['sync'] = $this->getSiteStats( array(), false ); + $information['sync'] = $this->get_site_stats( array(), false ); } MainWP_Helper::write( $information ); } - public function doSecurityUnFix() { + public function do_security_un_fix() { $information = array(); $sync = false; @@ -3316,13 +3316,13 @@ class MainWP_Child { MainWP_Helper::update_option( 'mainwp_security', $security, 'yes' ); if ( $sync ) { - $information['sync'] = $this->getSiteStats( array(), false ); + $information['sync'] = $this->get_site_stats( array(), false ); } MainWP_Helper::write( $information ); } - public function getSecurityStats() { + public function get_security_stats() { $information = array(); $information['listing'] = ( ! MainWP_Security::prevent_listing_ok() ? 'N' : 'Y' ); @@ -3339,7 +3339,7 @@ class MainWP_Child { MainWP_Helper::write( $information ); } - public function updateExternalSettings() { + public function update_external_settings() { $update_htaccess = false; if ( isset( $_POST['cloneSites'] ) ) { @@ -3371,11 +3371,11 @@ class MainWP_Child { } // Show stats. - public function getSiteStats( $information = array(), $exit = true ) { + public function get_site_stats( $information = array(), $exit = true ) { global $wp_version; if ( $exit ) { - $this->updateExternalSettings(); + $this->update_external_settings(); } MainWP_Child_Branding::Instance()->save_branding_options( 'branding_disconnected', '' ); @@ -3414,7 +3414,7 @@ class MainWP_Child { $pubkey = get_option( 'mainwp_child_pubkey' ); $nossl = get_option( 'mainwp_child_nossl' ); if ( 1 == $nossl ) { - if ( isset( $pubkey ) && MainWP_Helper::isSSLEnabled() ) { + if ( isset( $pubkey ) && MainWP_Helper::is_ssl_enabled() ) { MainWP_Helper::update_option( 'mainwp_child_nossl', 0, 'yes' ); $nossl = 0; } @@ -3694,7 +3694,7 @@ class MainWP_Child { $information['securityIssues'] = $securityIssuess; // Directory listings! - $information['directories'] = $this->scanDir( ABSPATH, 3 ); + $information['directories'] = $this->scan_dir( ABSPATH, 3 ); $cats = get_categories( array( 'hide_empty' => 0, @@ -3711,7 +3711,7 @@ class MainWP_Child { if ( $get_file_size && isset( $_POST['cloneSites'] ) && ( '0' !== $_POST['cloneSites'] ) ) { $max_exe = ini_get( 'max_execution_time' ); if ( $max_exe > 20 ) { - $information['totalsize'] = $this->getTotalFileSize(); + $information['totalsize'] = $this->get_total_file_size(); } } $information['dbsize'] = MainWP_Child_DB::get_size(); @@ -3740,7 +3740,7 @@ class MainWP_Child { if ( isset( $last_post ) && isset( $last_post['post_modified_gmt'] ) ) { $information['last_post_gmt'] = strtotime( $last_post['post_modified_gmt'] ); } - $information['mainwpdir'] = ( MainWP_Helper::validateMainWPDir() ? 1 : - 1 ); + $information['mainwpdir'] = ( MainWP_Helper::validate_mainwp_dir() ? 1 : - 1 ); $information['uniqueId'] = get_option( 'mainwp_child_uniqueId', '' ); $information['plugins_outdate_info'] = MainWP_Child_Plugins_Check::Instance()->get_plugins_outdate_info(); $information['themes_outdate_info'] = MainWP_Child_Themes_Check::Instance()->get_themes_outdate_info(); @@ -3864,7 +3864,7 @@ class MainWP_Child { } } - public function scanDir( $pDir, $pLvl ) { + public function scan_dir( $pDir, $pLvl ) { $output = array(); if ( file_exists( $pDir ) && is_dir( $pDir ) ) { if ( 'logs' === basename( $pDir ) ) { @@ -3873,7 +3873,7 @@ class MainWP_Child { if ( 0 === $pLvl ) { return empty( $output ) ? null : $output; } - $files = $this->intScanDir( $pDir ); + $files = $this->int_scan_dir( $pDir ); if ( $files ) { foreach ( $files as $file ) { if ( ( '.' === $file ) || ( '..' === $file ) ) { @@ -3881,7 +3881,7 @@ class MainWP_Child { } $newDir = $pDir . $file . DIRECTORY_SEPARATOR; if ( is_dir( $newDir ) ) { - $output[ $file ] = $this->scanDir( $newDir, $pLvl - 1, false ); + $output[ $file ] = $this->scan_dir( $newDir, $pLvl - 1, false ); } } @@ -3893,7 +3893,7 @@ class MainWP_Child { return empty( $output ) ? null : $output; } - public function intScanDir( $dir ) { + public function int_scan_dir( $dir ) { $dh = opendir( $dir ); if ( is_dir( $dir ) && $dh ) { $cnt = 0; @@ -4430,7 +4430,7 @@ class MainWP_Child { include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php'; include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php'; - $wp_filesystem = $this->getWPFilesystem(); + $wp_filesystem = $this->get_wp_filesystem(); if ( empty( $wp_filesystem ) ) { $wp_filesystem = new WP_Filesystem_Direct( null ); } @@ -4470,7 +4470,7 @@ class MainWP_Child { if ( ! isset( $information['status'] ) ) { $information['status'] = 'SUCCESS'; } - $information['sync'] = $this->getSiteStats( array(), false ); + $information['sync'] = $this->get_site_stats( array(), false ); MainWP_Helper::write( $information ); } @@ -4556,7 +4556,7 @@ class MainWP_Child { include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php'; include_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php'; - $wp_filesystem = $this->getWPFilesystem(); + $wp_filesystem = $this->get_wp_filesystem(); if ( null === $wp_filesystem ) { $wp_filesystem = new WP_Filesystem_Direct( null ); } @@ -4590,7 +4590,7 @@ class MainWP_Child { if ( ! isset( $information['status'] ) ) { $information['status'] = 'SUCCESS'; } - $information['sync'] = $this->getSiteStats( array(), false ); + $information['sync'] = $this->get_site_stats( array(), false ); MainWP_Helper::write( $information ); } @@ -4780,7 +4780,7 @@ class MainWP_Child { } // Show stats without login - only allowed while no account is added yet. - public function getSiteStatsNoAuth( $information = array() ) { + public function get_site_stats_no_auth( $information = array() ) { if ( get_option( 'mainwp_child_pubkey' ) ) { $hint = '