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 { - + @@ -821,7 +821,7 @@ class MainWP_Child_Server_Information { return ini_get( 'default_socket_timeout' ); } - protected static function getCurlVersion() { + protected static function get_curl_version() { $curlversion = curl_version(); return $curlversion['version']; @@ -835,13 +835,13 @@ class MainWP_Child_Server_Information { return false; } - protected static function getCurlSSLVersion() { + protected static function get_curl_ssl_version() { $curlversion = curl_version(); return $curlversion['ssl_version']; } - public static function mainwpRequiredFunctions() { + public static function mainwp_required_functions() { $disabled_functions = ini_get( 'disable_functions' ); if ( '' !== $disabled_functions ) { $arr = explode( ',', $disabled_functions ); @@ -913,7 +913,7 @@ class MainWP_Child_Server_Information { foreach ( $cron_info as $key => $schedule ) { ?> - + @@ -936,7 +936,7 @@ class MainWP_Child_Server_Information { $branding_title .= ' Upload Directory'; try { - $dirs = MainWP_Helper::getMainWPDir( null, false ); + $dirs = MainWP_Helper::get_mainwp_dir( null, false ); $path = $dirs[0]; } catch ( Exception $e ) { return self::renderDirectoryRow( $branding_title, '', 'Writable', $e->getMessage(), false ); @@ -950,7 +950,7 @@ class MainWP_Child_Server_Information { } } - $hasWPFileSystem = MainWP_Helper::getWPFilesystem(); + $hasWPFileSystem = MainWP_Helper::get_wp_filesystem(); global $wp_filesystem; diff --git a/class/class-mainwp-child-staging.php b/class/class-mainwp-child-staging.php index 13566fc..880d712 100644 --- a/class/class-mainwp-child-staging.php +++ b/class/class-mainwp-child-staging.php @@ -38,7 +38,7 @@ class MainWP_Child_Staging { 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 ); } @@ -59,7 +59,7 @@ class MainWP_Child_Staging { } } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncWPStaging'] ) && $data['syncWPStaging'] ) { try { $information['syncWPStaging'] = $this->get_sync_data(); diff --git a/class/class-mainwp-child-timecapsule.php b/class/class-mainwp-child-timecapsule.php index 2977010..9659252 100644 --- a/class/class-mainwp-child-timecapsule.php +++ b/class/class-mainwp-child-timecapsule.php @@ -34,7 +34,7 @@ class MainWP_Child_Timecapsule { 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 ); } @@ -233,7 +233,7 @@ class MainWP_Child_Timecapsule { return $information; } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncWPTimeCapsule'] ) && $data['syncWPTimeCapsule'] ) { $information['syncWPTimeCapsule'] = $this->get_sync_data(); if ( get_option( 'mainwp_time_capsule_ext_enabled' ) !== 'Y' ) { diff --git a/class/class-mainwp-child-updraft-plus-backups.php b/class/class-mainwp-child-updraft-plus-backups.php index 094fa79..770e73c 100644 --- a/class/class-mainwp-child-updraft-plus-backups.php +++ b/class/class-mainwp-child-updraft-plus-backups.php @@ -35,11 +35,11 @@ class MainWP_Child_Updraft_Plus_Backups { return; } - add_filter( 'mainwp-site-sync-others-data', array( $this, 'syncOthersData' ), 10, 2 ); - add_filter( 'updraftplus_save_last_backup', array( __CLASS__, 'hookUpdraftplusSaveLastBackup' ) ); + add_filter( 'mainwp-site-sync-others-data', array( $this, 'sync_others_data' ), 10, 2 ); + add_filter( 'updraftplus_save_last_backup', array( __CLASS__, 'hook_updraft_plus_save_last_backup' ) ); } - public static function hookUpdraftplusSaveLastBackup( $last_backup ) { + public static function hook_updraft_plus_save_last_backup( $last_backup ) { if ( ! is_array( $last_backup ) ) { return $last_backup; } @@ -53,7 +53,7 @@ class MainWP_Child_Updraft_Plus_Backups { return $last_backup; } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { try { if ( isset( $data['syncUpdraftData'] ) ) { $info = $data['syncUpdraftData']; @@ -126,7 +126,7 @@ class MainWP_Child_Updraft_Plus_Backups { $information = $this->next_scheduled_backups(); break; case 'forcescheduledresumption': - $information = $this->forceScheduledResumption(); + $information = $this->force_scheduled_resumption(); break; case 'fetch_updraft_log': $information = $this->fetch_updraft_log(); @@ -147,7 +147,7 @@ class MainWP_Child_Updraft_Plus_Backups { $information = $this->restore_alldownloaded(); break; case 'restorebackup': // not used! - $information = $this->restoreBackup(); + $information = $this->restore_backup(); break; case 'extradbtestconnection': $information = $this->extradb_testconnection(); @@ -1349,7 +1349,7 @@ class MainWP_Child_Updraft_Plus_Backups { $rescan = ( null !== $rescan ) ? $rescan : $_POST['rescan']; if ( $rescan ) { - $messages = $this->rebuildBackupHistory( $remotescan ); + $messages = $this->rebuild_backup_history( $remotescan ); } $backup_history = UpdraftPlus_Backup_History::get_history(); @@ -1735,7 +1735,7 @@ class MainWP_Child_Updraft_Plus_Backups { } // not used. - public function restoreBackup() { + public function restore_backup() { global $updraftplus_admin, $updraftplus; if ( empty( $updraftplus_admin ) ) { @@ -1745,7 +1745,7 @@ class MainWP_Child_Updraft_Plus_Backups { $backup_success = $this->restore_backup( $_REQUEST['backup_timestamp'] ); if ( empty( $updraftplus->errors ) && true === $backup_success ) { // If we restored the database, then that will have out-of-date information which may confuse the user - so automatically re-scan for them. - $this->rebuildBackupHistory(); + $this->rebuild_backup_history(); echo '

'; $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 = '
' . __( 'Hint: Go to the child site, deactivate and reactivate the MainWP Child plugin and try again.', 'mainwp-child' ); MainWP_Helper::error( __( 'This site already contains a link. Please deactivate and reactivate the MainWP plugin.', 'mainwp-child' ) . $hint ); @@ -4862,7 +4862,7 @@ class MainWP_Child { } } - public function getWPFilesystem() { + public function get_wp_filesystem() { global $wp_filesystem; if ( empty( $wp_filesystem ) ) { @@ -4893,10 +4893,10 @@ class MainWP_Child { return $wp_filesystem; } - public function getTotalFileSize( $directory = WP_CONTENT_DIR ) { + public function get_total_file_size( $directory = WP_CONTENT_DIR ) { try { if ( MainWP_Helper::function_exists( 'popen' ) ) { - $uploadDir = MainWP_Helper::getMainWPDir(); + $uploadDir = MainWP_Helper::get_mainwp_dir(); $uploadDir = $uploadDir[0]; $popenHandle = popen( 'du -s ' . $directory . ' --exclude "' . str_replace( ABSPATH, '', $uploadDir ) . '"', 'r' ); if ( 'resource' === gettype( $popenHandle ) ) { @@ -4910,7 +4910,7 @@ class MainWP_Child { } if ( MainWP_Helper::function_exists( 'shell_exec' ) ) { - $uploadDir = MainWP_Helper::getMainWPDir(); + $uploadDir = MainWP_Helper::get_mainwp_dir(); $uploadDir = $uploadDir[0]; $size = shell_exec( 'du -s ' . $directory . ' --exclude "' . str_replace( ABSPATH, '', $uploadDir ) . '"' ); if ( null !== $size ) { @@ -4950,7 +4950,7 @@ class MainWP_Child { } } - public function serverInformation() { + public function server_information() { ob_start(); MainWP_Child_Server_Information::render(); $output['information'] = ob_get_contents(); @@ -5020,8 +5020,8 @@ class MainWP_Child { // to fix issue of meta_value short length. $performed_what[] = 'revisions'; // 'Posts revisions deleted'. } else { - $results = MainWP_Helper::getRevisions( $max_revisions ); - $count_deleted = MainWP_Helper::deleteRevisions( $results, $max_revisions ); + $results = MainWP_Helper::get_revisions( $max_revisions ); + $count_deleted = MainWP_Helper::delete_revisions( $results, $max_revisions ); $performed_what[] = 'revisions'; // 'Posts revisions deleted'. } @@ -5188,7 +5188,7 @@ class MainWP_Child { wp_mail( $email, 'MainWP - 404 Alert: ' . $blog, - MainWP_Helper::formatEmail( $email, $mail ), + MainWP_Helper::format_email( $email, $mail ), array( 'content-type: text/html', ) @@ -5224,7 +5224,7 @@ class MainWP_Child { } if ( 'C' === $type ) { // save into wp-config file. - if ( false !== $this->snippetUpdateWPConfig( 'save', $slug, $code ) ) { + if ( false !== $this->snippet_update_wp_config( 'save', $slug, $code ) ) { $information['status'] = 'SUCCESS'; } } else { @@ -5243,7 +5243,7 @@ class MainWP_Child { $snippets = array(); } if ( 'C' === $type ) { // delete in wp-config file. - if ( false !== $this->snippetUpdateWPConfig( 'delete', $slug ) ) { + if ( false !== $this->snippet_update_wp_config( 'delete', $slug ) ) { $information['status'] = 'SUCCESS'; } } else { @@ -5260,7 +5260,7 @@ class MainWP_Child { MainWP_Helper::write( $information ); } - public function snippetUpdateWPConfig( $action, $slug, $code = '' ) { + public function snippet_update_wp_config( $action, $slug, $code = '' ) { $config_file = ''; if ( file_exists( ABSPATH . 'wp-config.php' ) ) { @@ -5343,7 +5343,7 @@ class MainWP_Child { } try { - $upload = MainWP_Helper::uploadFile( $file_url, $dir, $filename ); + $upload = MainWP_Helper::upload_file( $file_url, $dir, $filename ); if ( null !== $upload ) { $information['success'] = true; } @@ -5408,7 +5408,7 @@ class MainWP_Child { public function delete_backup() { - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = $dirs[0]; $file = $_REQUEST['del']; @@ -5426,14 +5426,14 @@ class MainWP_Child { MainWP_Helper::write( array( 'result' => 'ok' ) ); } - public function uploadFile( $file, $offset = 0 ) { - $dirs = MainWP_Helper::getMainWPDir( 'backup' ); + public function upload_file( $file, $offset = 0 ) { + $dirs = MainWP_Helper::get_mainwp_dir( 'backup' ); $backupdir = $dirs[0]; header( 'Content-Description: File Transfer' ); header( 'Content-Description: File Transfer' ); - if ( MainWP_Helper::endsWith( $file, '.tar.gz' ) ) { + if ( MainWP_Helper::ends_with( $file, '.tar.gz' ) ) { header( 'Content-Type: application/x-gzip' ); header( 'Content-Encoding: gzip' ); } else { diff --git a/class/class-mainwp-client-report.php b/class/class-mainwp-client-report.php index ea8ebdc..eabfb62 100644 --- a/class/class-mainwp-client-report.php +++ b/class/class-mainwp-client-report.php @@ -19,7 +19,7 @@ class MainWP_Client_Report { } public function init() { - 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_log', array( 'MainWP_Client_Report', 'do_reports_log' ) ); } @@ -30,7 +30,7 @@ class MainWP_Client_Report { return $agent; } - public function syncOthersData( $information, $data = array() ) { + public function sync_others_data( $information, $data = array() ) { if ( isset( $data['syncClientReportData'] ) && $data['syncClientReportData'] ) { $creport_sync_data = array(); $firsttime = get_option( 'mainwp_creport_first_time_activated' ); @@ -487,28 +487,33 @@ class MainWP_Client_Report { continue; } + $valid_context = false; // check context. if ( 'comments' == $context ) { // multi values. $comment_contexts = array( 'post', 'page' ); if ( ! in_array( $record->context, $comment_contexts ) ) { continue; } + $valid_context = true; } elseif ( 'post' === $context && 'created' === $action ) { if ( in_array( $record->ID, $skip_records ) ) { continue; } + $valid_context = true; } elseif ( 'menus' == $context ) { - // ok, pass, don't check context. + $valid_context = true; // ok, pass, don't check context. } elseif ( 'editor' == $record->connector ) { - // ok, pass, checked above. + $valid_context = true; // ok, pass, checked above. } elseif ( 'media' == $connector && 'media' == $record->connector ) { - // ok, pass, do not check context. + $valid_context = true; // ok, pass, do not check context. } elseif ( 'widgets' == $connector && 'widgets' == $record->connector ) { - // ok, pass, don't check context. - } elseif ( strtolower( $record->context ) !== $context ) { + $valid_context = true; // ok, pass, don't check context. + } + + if ( ! $valid_context || strtolower( $record->context ) !== $context ) { continue; } - + // custom action value. if ( 'widgets' == $connector ) { if ( 'deleted' == $action ) { @@ -707,10 +712,10 @@ class MainWP_Client_Report { $tok_value = $record->ID; break; case 'date': - $tok_value = MainWP_Helper::formatDate( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) ); + $tok_value = MainWP_Helper::format_date( MainWP_Helper::get_timestamp( strtotime( $record->created ) ) ); break; case 'time': - $tok_value = MainWP_Helper::formatTime( MainWP_Helper::getTimestamp( strtotime( $record->created ) ) ); + $tok_value = MainWP_Helper::format_time( MainWP_Helper::get_timestamp( strtotime( $record->created ) ) ); break; case 'area': $data = 'sidebar_name'; diff --git a/class/class-mainwp-clone-install.php b/class/class-mainwp-clone-install.php index 0504231..fdbc47d 100644 --- a/class/class-mainwp-clone-install.php +++ b/class/class-mainwp-clone-install.php @@ -176,12 +176,12 @@ class MainWP_Clone_Install { } try { - $dirs = MainWP_Helper::getMainWPDir( 'backup', false ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup', false ); $backupdir = $dirs[0]; $files = glob( $backupdir . '*' ); foreach ( $files as $file ) { - if ( MainWP_Helper::isArchive( $file ) ) { + if ( MainWP_Helper::is_archive( $file ) ) { unlink( $file ); } } @@ -448,7 +448,7 @@ class MainWP_Clone_Install { } public function extractWPZipBackup() { - MainWP_Helper::getWPFilesystem(); + MainWP_Helper::get_wp_filesystem(); global $wp_filesystem; $tmpdir = ABSPATH; diff --git a/class/class-mainwp-clone.php b/class/class-mainwp-clone.php index 95bf1c2..4bb8796 100644 --- a/class/class-mainwp-clone.php +++ b/class/class-mainwp-clone.php @@ -47,7 +47,7 @@ class MainWP_Clone { } public function secure_request( $action = '', $query_arg = 'security' ) { - if ( ! MainWP_Helper::isAdmin() ) { + if ( ! MainWP_Helper::is_admin() ) { die( 0 ); } if ( '' == $action ) { @@ -105,7 +105,7 @@ class MainWP_Clone { global $wp_scripts; $ui = $wp_scripts->query( 'jquery-ui-core' ); $version = $ui->ver; - if ( MainWP_Helper::startsWith( $version, '1.10' ) ) { + if ( MainWP_Helper::starts_with( $version, '1.10' ) ) { wp_enqueue_style( 'jquery-ui-style', plugins_url( '/css/1.10.4/jquery-ui.min.css', dirname( __FILE__ ) ), array(), '1.10', 'all' ); } else { wp_enqueue_style( 'jquery-ui-style', plugins_url( '/css/1.11.1/jquery-ui.min.css', dirname( __FILE__ ) ), array(), '1.11', 'all' ); @@ -153,7 +153,7 @@ class MainWP_Clone { return; } $error = false; - MainWP_Helper::getWPFilesystem(); + MainWP_Helper::get_wp_filesystem(); global $wp_filesystem; if ( ( ! empty( $wp_filesystem ) && ! $wp_filesystem->is_writable( WP_CONTENT_DIR ) ) || ( empty( $wp_filesystem ) && ! is_writable( WP_CONTENT_DIR ) ) ) { echo '
' . esc_html__( 'Your content directory is not writable. Please set 0755 permission to ', 'mainwp-child' ) . esc_html( basename( WP_CONTENT_DIR ) ) . '. (' . esc_html( WP_CONTENT_DIR ) . ')
'; @@ -193,10 +193,10 @@ class MainWP_Clone { $siteToClone ) { ?> -
+
MB
-
+
is_writable( WP_CONTENT_DIR ) ) || ( empty( $wp_filesystem ) && ! is_writable( WP_CONTENT_DIR ) ) ) { echo '
' . esc_html__( 'Your content directory is not writable. Please set 0755 permission to ', 'mainwp-child' ) . esc_html( basename( WP_CONTENT_DIR ) ) . '. (' . esc_html( WP_CONTENT_DIR ) . ')
'; @@ -337,7 +337,7 @@ class MainWP_Clone { $page = $_REQUEST['page']; $sitesToClone = get_option( 'mainwp_child_clone_sites' ); $url = admin_url( 'options-general.php?page=mainwp_child_tab&tab=restore-clone#title_03' ); - $dirs = MainWP_Helper::getMainWPDir( 'backup', false ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup', false ); $current_dir = $dirs[0]; $backup_dir = $current_dir; @@ -420,7 +420,7 @@ class MainWP_Clone { if ( is_dir( $current_dir . '/' . $file ) ) { $directories[] = $file; } else { - if ( ! MainWP_Helper::isArchive( $file ) ) { + if ( ! MainWP_Helper::is_archive( $file ) ) { $rejected_files[] = $file; } else { $files[] = $file; @@ -1156,11 +1156,11 @@ class MainWP_Clone { $url = $siteToClone['url']; $key = $siteToClone['extauth']; - MainWP_Helper::endSession(); + MainWP_Helper::end_session(); // Send request to the childsite! global $wp_version; $method = ( function_exists( 'gzopen' ) ? 'tar.gz' : 'zip' ); - $result = MainWP_Helper::fetchUrl( + $result = MainWP_Helper::fetch_url( $url, array( 'cloneFunc' => 'createCloneBackup', @@ -1211,9 +1211,9 @@ class MainWP_Clone { $key = $siteToClone['extauth']; - MainWP_Helper::endSession(); + MainWP_Helper::end_session(); // Send request to the childsite! - $result = MainWP_Helper::fetchUrl( + $result = MainWP_Helper::fetch_url( $url, array( 'cloneFunc' => 'createCloneBackupPoll', @@ -1259,18 +1259,18 @@ class MainWP_Clone { } else { $url = $file; } - MainWP_Helper::endSession(); + MainWP_Helper::end_session(); // Send request to the childsite! $split = explode( '=', $file ); $file = urldecode( $split[ count( $split ) - 1 ] ); $filename = 'download-' . basename( $file ); - $dirs = MainWP_Helper::getMainWPDir( 'backup', false ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup', false ); $backupdir = $dirs[0]; $dh = opendir( $backupdir ); if ( $dh ) { $file = readdir( $dh ); while ( false !== $file ) { - if ( '.' !== $file && '..' !== $file && MainWP_Helper::isArchive( $file, 'download-' ) ) { + if ( '.' !== $file && '..' !== $file && MainWP_Helper::is_archive( $file, 'download-' ) ) { unlink( $backupdir . $file ); } } @@ -1310,7 +1310,7 @@ class MainWP_Clone { if ( is_array( $sitesToClone ) && isset( $sitesToClone[ $siteId ] ) ) { $siteToClone = $sitesToClone[ $siteId ]; - MainWP_Helper::fetchUrl( + MainWP_Helper::fetch_url( $siteToClone['url'], array( 'cloneFunc' => 'deleteCloneBackup', @@ -1335,15 +1335,15 @@ class MainWP_Clone { try { $this->secure_request( 'mainwp-child_clone_backupdownloadpoll' ); - MainWP_Helper::endSession(); + MainWP_Helper::end_session(); - $dirs = MainWP_Helper::getMainWPDir( 'backup', false ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup', false ); $backupdir = $dirs[0]; $files = glob( $backupdir . 'download-*' ); $archiveFile = false; foreach ( $files as $file ) { - if ( MainWP_Helper::isArchive( $file, 'download-' ) ) { + if ( MainWP_Helper::is_archive( $file, 'download-' ) ) { $archiveFile = $file; break; } @@ -1362,18 +1362,18 @@ class MainWP_Clone { try { $this->secure_request( 'mainwp-child_clone_backupextract' ); - MainWP_Helper::endSession(); + MainWP_Helper::end_session(); $file = ( isset( $_POST['f'] ) ? $_POST['f'] : $_POST['file'] ); $testFull = false; if ( '' === $file ) { - $dirs = MainWP_Helper::getMainWPDir( 'backup', false ); + $dirs = MainWP_Helper::get_mainwp_dir( 'backup', false ); $backupdir = $dirs[0]; $files = glob( $backupdir . 'download-*' ); $archiveFile = false; foreach ( $files as $file ) { - if ( MainWP_Helper::isArchive( $file, 'download-' ) ) { + if ( MainWP_Helper::is_archive( $file, 'download-' ) ) { $archiveFile = $file; break; } @@ -1428,7 +1428,7 @@ class MainWP_Clone { MainWP_Helper::update_option( 'mainwp_child_nossl', $nossl, 'yes' ); MainWP_Helper::update_option( 'mainwp_child_nossl_key', $nossl_key ); MainWP_Helper::update_option( 'mainwp_child_clone_sites', $sitesToClone ); - if ( ! MainWP_Helper::startsWith( basename( $file ), 'download-backup-' ) ) { + if ( ! MainWP_Helper::starts_with( basename( $file ), 'download-backup-' ) ) { MainWP_Helper::update_option( 'mainwp_child_restore_permalink', true, 'yes' ); } else { MainWP_Helper::update_option( 'mainwp_child_clone_permalink', true, 'yes' ); diff --git a/class/class-mainwp-custom-post-type.php b/class/class-mainwp-custom-post-type.php index 08177bb..09d726e 100755 --- a/class/class-mainwp-custom-post-type.php +++ b/class/class-mainwp-custom-post-type.php @@ -102,7 +102,7 @@ class MainWP_Custom_Post_Type { } try { - $downloadfile = MainWP_Helper::uploadImage( $originalImgUrl, array(), $check_image ); + $downloadfile = MainWP_Helper::upload_image( $originalImgUrl, array(), $check_image ); $localUrl = $downloadfile['url']; $linkToReplaceWith = dirname( $localUrl ); if ( '' !== $hrefLink ) { @@ -231,7 +231,7 @@ class MainWP_Custom_Post_Type { if ( isset( $data['extras']['woocommerce']['product_images'] ) ) { foreach ( $data['extras']['woocommerce']['product_images'] as $product_image ) { try { - $upload_featured_image = MainWP_Helper::uploadImage( $product_image, array(), $check_image_existed ); + $upload_featured_image = MainWP_Helper::upload_image( $product_image, array(), $check_image_existed ); if ( null !== $upload_featured_image ) { $product_image_gallery[] = $upload_featured_image['id']; @@ -252,7 +252,7 @@ class MainWP_Custom_Post_Type { if ( '_thumbnail_id' == $key['meta_key'] ) { if ( isset( $data['extras']['featured_image'] ) ) { try { - $upload_featured_image = MainWP_Helper::uploadImage( $data['extras']['featured_image'], array(), $check_image_existed ); + $upload_featured_image = MainWP_Helper::upload_image( $data['extras']['featured_image'], array(), $check_image_existed ); if ( null !== $upload_featured_image ) { $key['meta_value'] = $upload_featured_image['id']; diff --git a/class/class-mainwp-debug.php b/class/class-mainwp-debug.php index 862df8a..e85701f 100644 --- a/class/class-mainwp-debug.php +++ b/class/class-mainwp-debug.php @@ -25,7 +25,7 @@ class MainWP_Debug { } elseif ( 'test' == $_GET['mainwpdebug'] ) { print_r( get_included_files() ); } else { - print_r( $mainwpChild->getSiteStats( array(), false ) ); + print_r( $mainwpChild->get_site_stats( array(), false ) ); } $stop = microtime( true ); diff --git a/class/class-mainwp-helper.php b/class/class-mainwp-helper.php index c3adc27..c0922cd 100644 --- a/class/class-mainwp-helper.php +++ b/class/class-mainwp-helper.php @@ -201,7 +201,7 @@ class MainWP_Helper { // $check_file_existed: to support checking if file existed. // $parent_id: optional. - public static function uploadImage( $img_url, $img_data = array(), $check_file_existed = false, $parent_id = 0 ) { + public static function upload_image( $img_url, $img_data = array(), $check_file_existed = false, $parent_id = 0 ) { if ( ! is_array( $img_data ) ) { $img_data = array(); } @@ -318,7 +318,7 @@ class MainWP_Helper { return $wpdb->get_results( $sql ); } - public static function uploadFile( $file_url, $path, $file_name ) { + public static function upload_file( $file_url, $path, $file_name ) { // to fix uploader extension rename htaccess file issue. if ( '.htaccess' != $file_name && '.htpasswd' != $file_name ) { $file_name = sanitize_file_name( $file_name ); @@ -359,7 +359,7 @@ class MainWP_Helper { return array( 'path' => $full_file_name ); } - public static function createPost( $new_post, $post_custom, $post_category, $post_featured_image, $upload_dir, $post_tags, $others = array() ) { + public static function create_post( $new_post, $post_custom, $post_category, $post_featured_image, $upload_dir, $post_tags, $others = array() ) { global $current_user; /** @@ -487,7 +487,7 @@ class MainWP_Helper { } try { - $downloadfile = self::uploadImage( $originalImgUrl, array(), $check_image_existed ); + $downloadfile = self::upload_image( $originalImgUrl, array(), $check_image_existed ); $localUrl = $downloadfile['url']; $linkToReplaceWith = dirname( $localUrl ); if ( '' !== $hrefLink ) { @@ -518,7 +518,7 @@ class MainWP_Helper { foreach ( $post_gallery_images as $gallery ) { if ( isset( $gallery['src'] ) ) { try { - $upload = self::uploadImage( $gallery['src'], $gallery ); // Upload image to WP. + $upload = self::upload_image( $gallery['src'], $gallery ); // Upload image to WP. if ( null !== $upload ) { $replaceAttachedIds[ $gallery['id'] ] = $upload['id']; } @@ -716,7 +716,7 @@ class MainWP_Helper { // upload image if it on the server. if ( ! empty( $_seo_opengraph_image ) && false !== strpos( $_seo_opengraph_image, $_server_domain ) ) { try { - $upload = self::uploadImage( $_seo_opengraph_image ); // Upload image to WP. + $upload = self::upload_image( $_seo_opengraph_image ); // Upload image to WP. if ( null !== $upload ) { update_post_meta( $new_post_id, WPSEO_Meta::$meta_prefix . 'opengraph-image', $upload['url'] ); // Add the image to the post! } @@ -752,7 +752,7 @@ class MainWP_Helper { // If featured image exists - set it. if ( null !== $post_featured_image ) { try { - $upload = self::uploadImage( $post_featured_image, array(), $check_image_existed, $new_post_id ); // Upload image to WP. + $upload = self::upload_image( $post_featured_image, array(), $check_image_existed, $new_post_id ); // Upload image to WP. if ( null !== $upload ) { update_post_meta( $new_post_id, '_thumbnail_id', $upload['id'] ); // Add the thumbnail to the post! $featured_image_exist = true; @@ -851,10 +851,10 @@ class MainWP_Helper { return $ret; } - public static function getMainWPDir( $what = null, $dieOnError = true ) { + public static function get_mainwp_dir( $what = null, $dieOnError = true ) { $upload_dir = wp_upload_dir(); $dir = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . 'mainwp' . DIRECTORY_SEPARATOR; - self::checkDir( $dir, $dieOnError ); + self::check_dir( $dir, $dieOnError ); if ( ! file_exists( $dir . 'index.php' ) ) { touch( $dir . 'index.php' ); } @@ -862,7 +862,7 @@ class MainWP_Helper { if ( 'backup' === $what ) { $dir .= 'backup' . DIRECTORY_SEPARATOR; - self::checkDir( $dir, $dieOnError ); + self::check_dir( $dir, $dieOnError ); if ( ! file_exists( $dir . 'index.php' ) ) { touch( $dir . 'index.php' ); } @@ -879,8 +879,8 @@ class MainWP_Helper { return array( $dir, $url ); } - public static function checkDir( $dir, $dieOnError, $chmod = 0755 ) { - self::getWPFilesystem(); + public static function check_dir( $dir, $dieOnError, $chmod = 0755 ) { + self::get_wp_filesystem(); global $wp_filesystem; if ( ! file_exists( $dir ) ) { if ( empty( $wp_filesystem ) ) { @@ -907,14 +907,14 @@ class MainWP_Helper { } } - public static function validateMainWPDir() { + public static function validate_mainwp_dir() { $done = false; - $dir = self::getMainWPDir(); + $dir = self::get_mainwp_dir(); $dir = $dir[0]; - if ( self::getWPFilesystem() ) { + if ( self::get_wp_filesystem() ) { global $wp_filesystem; try { - self::checkDir( $dir, false ); + self::check_dir( $dir, false ); } catch ( Exception $e ) { // ok! } @@ -960,7 +960,7 @@ class MainWP_Helper { /** * @return WP_Filesystem_Base */ - public static function getWPFilesystem() { + public static function get_wp_filesystem() { global $wp_filesystem; if ( empty( $wp_filesystem ) ) { @@ -987,11 +987,11 @@ class MainWP_Helper { return $init; } - public static function startsWith( $haystack, $needle ) { + public static function starts_with( $haystack, $needle ) { return ! strncmp( $haystack, $needle, strlen( $needle ) ); } - public static function endsWith( $haystack, $needle ) { + public static function ends_with( $haystack, $needle ) { $length = strlen( $needle ); if ( 0 == $length ) { return true; @@ -1000,14 +1000,14 @@ class MainWP_Helper { return ( substr( $haystack, - $length ) == $needle ); } - public static function getNiceURL( $pUrl, $showHttp = false ) { + public static function get_nice_url( $pUrl, $showHttp = false ) { $url = $pUrl; - if ( self::startsWith( $url, 'http://' ) ) { + if ( self::starts_with( $url, 'http://' ) ) { if ( ! $showHttp ) { $url = substr( $url, 7 ); } - } elseif ( self::startsWith( $pUrl, 'https://' ) ) { + } elseif ( self::starts_with( $pUrl, 'https://' ) ) { if ( ! $showHttp ) { $url = substr( $url, 8 ); } @@ -1017,7 +1017,7 @@ class MainWP_Helper { } } - if ( self::endsWith( $url, '/' ) ) { + if ( self::ends_with( $url, '/' ) ) { if ( ! $showHttp ) { $url = substr( $url, 0, strlen( $url ) - 1 ); } @@ -1036,29 +1036,29 @@ class MainWP_Helper { return $string; } - public static function endSession() { + public static function end_session() { session_write_close(); ob_end_flush(); } - public static function fetchUrl( $url, $postdata ) { + public static function fetch_url( $url, $postdata ) { try { $tmpUrl = $url; if ( '/' !== substr( $tmpUrl, - 1 ) ) { $tmpUrl .= '/'; } - return self::_fetchUrl( $tmpUrl . 'wp-admin/', $postdata ); + return self::m_fetch_url( $tmpUrl . 'wp-admin/', $postdata ); } catch ( Exception $e ) { try { - return self::_fetchUrl( $url, $postdata ); + return self::m_fetch_url( $url, $postdata ); } catch ( Exception $ex ) { throw $e; } } } - public static function _fetchUrl( $url, $postdata ) { + public static function m_fetch_url( $url, $postdata ) { $agent = 'Mozilla/5.0 (compatible; MainWP-Child/' . MainWP_Child::$version . '; +http://mainwp.com)'; if ( ! is_array( $postdata ) ) { @@ -1096,7 +1096,7 @@ class MainWP_Helper { } - public static function randString( $length, $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ) { + public static function rand_string( $length, $charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ) { $str = ''; $count = strlen( $charset ); while ( $length -- ) { @@ -1172,25 +1172,25 @@ class MainWP_Helper { return true; } - public static function getTimestamp( $timestamp ) { + public static function get_timestamp( $timestamp ) { $gmtOffset = get_option( 'gmt_offset' ); return ( $gmtOffset ? ( $gmtOffset * HOUR_IN_SECONDS ) + $timestamp : $timestamp ); } - public static function formatDate( $timestamp ) { + public static function format_date( $timestamp ) { return date_i18n( get_option( 'date_format' ), $timestamp ); } - public static function formatTime( $timestamp ) { + public static function format_time( $timestamp ) { return date_i18n( get_option( 'time_format' ), $timestamp ); } - public static function formatTimestamp( $timestamp ) { + public static function format_timestamp( $timestamp ) { return date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $timestamp ); } - public static function formatEmail( $to, $body ) { + public static function format_email( $to, $body ) { return '

@@ -1329,29 +1329,14 @@ class MainWP_Helper { return get_option( 'mainwp_lasttime_backup_' . $by, 0 ); } - - public static function containsAll( $haystack, $needle ) { - if ( ! is_array( $haystack ) || ! is_array( $needle ) ) { - return false; - } - - foreach ( $needle as $item ) { - if ( ! in_array( $item, $haystack ) ) { - return false; - } - } - - return true; - } - - public static function getRevisions( $max_revisions ) { + public static function get_revisions( $max_revisions ) { global $wpdb; $sql = " SELECT `post_parent`, COUNT(*) cnt FROM $wpdb->posts WHERE `post_type` = 'revision' GROUP BY `post_parent` HAVING COUNT(*) > " . $max_revisions; return $wpdb->get_results( $sql ); } - public static function deleteRevisions( $results, $max_revisions ) { + public static function delete_revisions( $results, $max_revisions ) { global $wpdb; if ( ! is_array( $results ) || 0 === count( $results ) ) { @@ -1382,20 +1367,20 @@ class MainWP_Helper { return $count_deleted; } - public static function inExcludes( $excludes, $value ) { + public static function in_excludes( $excludes, $value ) { if ( empty( $value ) ) { return false; } if ( null != $excludes ) { foreach ( $excludes as $exclude ) { - if ( self::endsWith( $exclude, '*' ) ) { - if ( self::startsWith( $value, substr( $exclude, 0, strlen( $exclude ) - 1 ) ) ) { + if ( self::ends_with( $exclude, '*' ) ) { + if ( self::starts_with( $value, substr( $exclude, 0, strlen( $exclude ) - 1 ) ) ) { return true; } } elseif ( $value == $exclude ) { return true; - } elseif ( self::startsWith( $value, $exclude . '/' ) ) { + } elseif ( self::starts_with( $value, $exclude . '/' ) ) { return true; } } @@ -1404,7 +1389,7 @@ class MainWP_Helper { return false; } - public static function isArchive( $pFileName, $pPrefix = '', $pSuffix = '' ) { + public static function is_archive( $pFileName, $pPrefix = '', $pSuffix = '' ) { return preg_match( '/' . $pPrefix . '(.*).(zip|tar|tar.gz|tar.bz2)' . $pSuffix . '$/', $pFileName ); } @@ -1538,7 +1523,7 @@ class MainWP_Helper { return false; } - public static function isAdmin() { + public static function is_admin() { global $current_user; if ( 0 == $current_user->ID ) { return false; @@ -1551,7 +1536,7 @@ class MainWP_Helper { return false; } - public static function isSSLEnabled() { + public static function is_ssl_enabled() { if ( defined( 'MAINWP_NOSSL' ) ) { return ! MAINWP_NOSSL; } diff --git a/class/class-mainwp-security.php b/class/class-mainwp-security.php index f4b3840..2764330 100644 --- a/class/class-mainwp-security.php +++ b/class/class-mainwp-security.php @@ -232,7 +232,7 @@ class MainWP_Security { if ( $force || self::get_security_option( 'readme' ) ) { if ( file_exists( ABSPATH . 'readme.html' ) ) { if ( ! unlink( ABSPATH . 'readme.html' ) ) { - MainWP_Helper::getWPFilesystem(); + MainWP_Helper::get_wp_filesystem(); global $wp_filesystem; if ( ! empty( $wp_filesystem ) ) { $wp_filesystem->delete( ABSPATH . 'readme.html' ); diff --git a/class/class-tar-archiver.php b/class/class-tar-archiver.php index f401204..891e9c6 100644 --- a/class/class-tar-archiver.php +++ b/class/class-tar-archiver.php @@ -166,9 +166,9 @@ class Tar_Archiver { '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 ) { @@ -193,12 +193,12 @@ class Tar_Archiver { 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->addDir( $node, $excludes ); } elseif ( is_file( $node ) ) { @@ -293,7 +293,7 @@ class Tar_Archiver { continue; } - if ( ! MainWP_Helper::inExcludes( $excludes, str_replace( ABSPATH, '', $name ) ) ) { + if ( ! MainWP_Helper::in_excludes( $excludes, str_replace( ABSPATH, '', $name ) ) ) { if ( $path->isDir() ) { $this->addEmptyDir( $name, str_replace( ABSPATH, '', $name ) ); } else { @@ -460,7 +460,7 @@ class Tar_Archiver { return false; } - if ( $this->excludeZip && MainWP_Helper::endsWith( $path, '.zip' ) ) { + if ( $this->excludeZip && MainWP_Helper::ends_with( $path, '.zip' ) ) { $this->log( 'Skipping ' . $path ); return false; @@ -1267,9 +1267,9 @@ if ( class_exists( 'SplHeap' ) ) { return strcmp( $pathA, $pathB ); } elseif ( $dirnameA == $dirnameB ) { return strcmp( $pathA, $pathB ); - } elseif ( MainWP_Helper::startsWith( $dirnameA, $dirnameB ) ) { + } elseif ( MainWP_Helper::starts_with( $dirnameA, $dirnameB ) ) { return 1; - } elseif ( MainWP_Helper::startsWith( $dirnameB, $dirnameA ) ) { + } elseif ( MainWP_Helper::starts_with( $dirnameB, $dirnameA ) ) { return - 1; } else { $cmp = strcmp( $dirnameA, $dirnameB );