diff --git a/class/class-mainwp-child-install.php b/class/class-mainwp-child-install.php index d76974e..f54363c 100644 --- a/class/class-mainwp-child-install.php +++ b/class/class-mainwp-child-install.php @@ -9,6 +9,8 @@ namespace MainWP\Child; /** * Class MainWP_Child_Install + * + * @package MainWP\Child */ class MainWP_Child_Install { diff --git a/class/class-mainwp-child-misc.php b/class/class-mainwp-child-misc.php index 5c129f1..d6d422d 100644 --- a/class/class-mainwp-child-misc.php +++ b/class/class-mainwp-child-misc.php @@ -1,27 +1,46 @@ get_favicon( true ); @@ -38,6 +60,12 @@ class MainWP_Child_Misc { MainWP_Helper::write( $information ); } + /** + * Get Child Site favicon. + * + * @param bool $parse_page Whether or not to parse the page. Default: false. + * @return string|bool Return $favi_url on success, FALSE on failure. + */ public function get_favicon( $parse_page = false ) { $favi_url = ''; @@ -80,6 +108,12 @@ class MainWP_Child_Misc { } } + /** + * Try to parse Child Site url for favicon. + * + * @param $site_url Child Site URL. + * @return mixed|string $favi_url parsed favicon. + */ private function try_to_parse_favicon( $site_url ) { $request = wp_remote_get( $site_url, array( 'timeout' => 50 ) ); $favi = ''; @@ -112,6 +146,9 @@ class MainWP_Child_Misc { return $favi_url; } + /** + * Get security stats. + */ public function get_security_stats() { $information = array(); @@ -130,6 +167,9 @@ class MainWP_Child_Misc { } + /** + * Perform Child Site security fixes. + */ public function do_security_fix() { $sync = false; if ( 'all' === $_POST['feature'] ) { @@ -207,6 +247,9 @@ class MainWP_Child_Misc { MainWP_Helper::write( $information ); } + /** + * Perform Child Site security unfixes. + */ public function do_security_un_fix() { $information = array(); @@ -262,6 +305,11 @@ class MainWP_Child_Misc { MainWP_Helper::write( $information ); } + /** + * Method settings_tools() + * + * @deprecated Unused Element + */ public function settings_tools() { if ( isset( $_POST['action'] ) ) { switch ( $_POST['action'] ) { @@ -289,6 +337,9 @@ class MainWP_Child_Misc { } } + /** + * Try to upload file to Child Site. + */ public function uploader_action() { $file_url = base64_decode( $_POST['url'] ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode function is used for http encode compatible.. $path = $_POST['path']; @@ -336,8 +387,18 @@ class MainWP_Child_Misc { } + /** + * Child Site file uploader. + * + * @param string $file_url URL of file to be uploaded. + * @param string $path Path to upload to. + * @param string $file_name Name of file to upload. + * + * @return string[] Full path and file name of uploaded file. + * @throws \Exception Error: Copy file. + */ public function uploader_upload_file( $file_url, $path, $file_name ) { - // to fix uploader extension rename htaccess file issue. + // Fixes: Uploader Extension rename htaccess file issue. if ( '.htaccess' != $file_name && '.htpasswd' != $file_name ) { $file_name = sanitize_file_name( $file_name ); } @@ -377,6 +438,9 @@ class MainWP_Child_Misc { return array( 'path' => $full_file_name ); } + /** + * Initiate Code Snippet action: run_snippet, save_snippet, delete_snippet. + */ public function code_snippet() { $action = $_POST['action']; @@ -413,6 +477,16 @@ class MainWP_Child_Misc { MainWP_Helper::write( $information ); } + /** + * Save code snippet. + * + * @param string $slug Snippet slug. + * @param string $type Type of snippet. + * @param string $code Snippet code. + * @param array $snippets Snippets array. + * + * @return array $return Status response. + */ private function snippet_save_snippet( $slug, $type, $code, $snippets ) { $return = array(); if ( 'C' === $type ) { // save into wp-config file. @@ -429,6 +503,15 @@ class MainWP_Child_Misc { return $return; } + /** + * Delete code snippets. + * + * @param string $slug Snippet slug. + * @param string $type Type of snippet. + * @param array $snippets Snippets array. + * + * @return array $return Status response. + */ private function snippet_delete_snippet( $slug, $type, $snippets ) { $return = array(); if ( 'C' === $type ) { // delete in wp-config file. @@ -448,6 +531,14 @@ class MainWP_Child_Misc { return $return; } + /** + * Update Child Site wp-config.php file. + * + * @param $action Action to perform: Delete, Save. + * @param $slug Snippet slug. + * @param string $code Code snippet. + * @return bool true|false. + */ public function snippet_update_wp_config( $action, $slug, $code = '' ) { $config_file = ''; diff --git a/class/class-mainwp-child.php b/class/class-mainwp-child.php index ad58ba8..76af31e 100644 --- a/class/class-mainwp-child.php +++ b/class/class-mainwp-child.php @@ -309,7 +309,8 @@ class MainWP_Child { * * Initiate the chech login process. * - * @uses MainWP_Connect::instance()->check_login() Auto-login user to the child site when the Open WP Admin feature from the MainWP Dashboard is used. + * @uses MainWP_Connect::instance()->check_login() Auto-login user to the child site when + * the Open WP Admin feature from the MainWP Dashboard is used. */ public function init_check_login() { MainWP_Connect::instance()->check_login(); @@ -351,7 +352,7 @@ class MainWP_Child { /** * Method deactivation() * - * Deactivate the MainWP Child plugin and delted unwanted data. + * Deactivate the MainWP Child plugin and delete unwanted data. * * @param bool $deact Whether or not to deactivate pugin. Default: true. */ @@ -388,7 +389,7 @@ class MainWP_Child { /** * Method activation() * - * Activate the MainWP Child plugin and delted unwanted data. + * Activate the MainWP Child plugin and delete unwanted data. */ public function activation() { $mu_plugin_enabled = apply_filters( 'mainwp_child_mu_plugin_enabled', false ); diff --git a/class/class-mainwp-clone-page.php b/class/class-mainwp-clone-page.php index 78c0098..9fe1009 100644 --- a/class/class-mainwp-clone-page.php +++ b/class/class-mainwp-clone-page.php @@ -1,21 +1,37 @@