예제 #1
0
 /**
  * 인스턴스를 반환한다.
  * @return KDFilesystem
  */
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new KDFilesystem();
     }
     return self::$instance;
 }
 public function pluginDownload()
 {
     if (!current_user_can('activate_plugins')) {
         echo '<script>alert("설치 권한이 없습니다.");</script>';
     } else {
         $file = KDFilesystem::getInstance();
         $install_dir = WP_CONTENT_DIR . '/plugins';
         $package = $_GET['package'] == 'kboard' ? 'kboard' : 'comments';
         $version = $_GET['version'];
         $form_url = wp_nonce_url(admin_url("/admin.php?page=kboard_downloader_main&action=kboard_downloader_execute&package={$package}&version={$version}"), 'kboard_downloader_execute');
         if (!$file->credentials($form_url, $install_dir)) {
             exit;
         }
         $result = $file->install($package, $version, $install_dir);
         if ($result) {
             echo '<script>alert("성공적으로 설치되었습니다. 플러그인을 활성화 해주세요.");</script>';
         } else {
             echo '<script>alert("설치에 실패 했습니다.");</script>';
         }
     }
 }