コード例 #1
0
 /**
  * Check result from Duplication page / print the page
  * @since 0.2.0
  */
 public static function network_page_admin_duplicate_site()
 {
     global $current_site;
     // Capabilities test
     if (!current_user_can('manage_sites')) {
         wp_die(MUCD_GAL_ERROR_CAPABILITIES);
     }
     // Getting Sites
     $site_list = MUCD_Functions::get_site_list();
     // Form Data
     $data = array('source' => isset($_GET['id']) ? intval($_GET['id']) : 0, 'domain' => '', 'title' => '', 'email' => '', 'copy_files' => 'yes', 'keep_users' => 'no', 'log' => 'no', 'log-path' => '', 'advanced' => 'hide-advanced-options');
     // Manage Form Post
     if (isset($_REQUEST['action']) && MUCD_SLUG_ACTION_DUPLICATE == $_REQUEST['action'] && !empty($_POST)) {
         $data = MUCD_Admin::check_form($data);
         if (isset($data['error'])) {
             $form_message['error'] = $data['error']->get_error_message();
         } else {
             $form_message = MUCD_Duplicate::duplicate_site($data);
         }
     }
     // Load template if at least one Site is available
     if ($site_list) {
         $select_site_list = MUCD_Admin::select_site_list($site_list, $data['source']);
         MUCD_Admin::enqueue_script_network_duplicate();
         require_once MUCD_COMPLETE_PATH . '/template/network_admin_duplicate_site.php';
     } else {
         return new WP_Error('mucd_error', MUCD_GAL_ERROR_NO_SITE);
     }
     MUCD_Duplicate::close_log();
 }