gdwpm_halaman_utama

The Google Drive WP Media gdwpm halaman utama function.

Description

gdwpm_halaman_utama(); 

Usage

  1. if ( !function_exists( 'gdwpm_halaman_utama' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-drive-wp-media/google-drive-wp-media.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gdwpm_halaman_utama(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/google-drive-wp-media.php  
  1. function gdwpm_halaman_utama() { 
  2. global $cek_kunci, $gdwpm_opt_akun, $gdwpm_service, $gdwpm_apiConfig; 
  3. require_once 'gdwpm-api/Google_Client.php'; 
  4. require_once 'gdwpm-api/contrib/Google_DriveService.php'; 
  5.  
  6. $cek_kunci = 'true'; // kosong 
  7. if(isset($_REQUEST['gdwpm_opsi_kategori_nonce'])) { 
  8. require_once(ABSPATH .'wp-includes/pluggable.php'); 
  9. if(!wp_verify_nonce( $_REQUEST['gdwpm_opsi_kategori_nonce'], 'gdwpm_override_dir' )) { 
  10. wp_die( '<div class="error"><p>Security check not verified!</p></div>' );  
  11. } else { 
  12. if($_POST['gdwpm_cekbok_opsi_kategori'] == 1) { 
  13. update_option('gdwpm_opsi_kategori_dr_folder', 'checked'); 
  14. echo '<div class="updated"><p>GDWPM Categories has been enabled.</p></div>'; 
  15. }else{ 
  16. update_option('gdwpm_opsi_kategori_dr_folder', ''); 
  17. echo '<div class="updated"><p>GDWPM Categories has been disabled.</p></div>'; 
  18.  
  19. if(isset($_REQUEST['gdwpm_opsi_chunkpl_nonce'])) { 
  20. require_once(ABSPATH .'wp-includes/pluggable.php'); 
  21. if(!wp_verify_nonce( $_REQUEST['gdwpm_opsi_chunkpl_nonce'], 'gdwpm_chunkpl_nonce' )) { 
  22. wp_die( '<div class="error"><p>Security check not verified!</p></div>' );  
  23. } else { 
  24. $input_cek = true; 
  25. $input_chunkarr = array('gdwpm_drive_chunk_size', 'gdwpm_drive_chunk_retries', 'gdwpm_local_chunk_size', 'gdwpm_local_chunk_retries'); 
  26. foreach($input_chunkarr as $val) { 
  27. if(!ctype_digit($_POST[$val])) { 
  28. $input_cek = false; 
  29. break; 
  30. if($input_cek) { 
  31. if (isset($_POST['gdwpm_cekbok_opsi_chunkpl'])) {$ceket = 'checked';}else{$ceket = '';} 
  32. update_option('gdwpm_opsi_chunk', array('local' => array('cekbok' => $ceket, 'chunk' => $_POST['gdwpm_local_chunk_size'], 'retries' => $_POST['gdwpm_local_chunk_retries']), 'drive' => array('cekbok' => 'checked', 'chunk' => $_POST['gdwpm_drive_chunk_size'], 'retries' => $_POST['gdwpm_drive_chunk_retries']))); 
  33. echo '<div class="updated"><p>Chunking Settings saved.</p></div>'; 
  34. }else{ 
  35. echo '<div class="error"><p>Chunking Settings cannot be saved. You must provide Numeric value.</p></div>'; 
  36. if (isset($_POST['gdwpm_akun_nonce'])) 
  37. $nonce = $_POST['gdwpm_akun_nonce']; 
  38. if ( ! wp_verify_nonce( $nonce, 'gdwpm_akun_nonce' ) ) { 
  39. die('<div class="error"><p>Oops.. security check is not ok!</p></div>');  
  40.  
  41. } else { 
  42. $gdwpm_opt_imel = sanitize_email($_POST['gdwpm_imel']); 
  43. $gdwpm_opt_klaen_aidi = sanitize_text_field($_POST['gdwpm_klaen_aidi']); 
  44. $gdwpm_opt_nama_service = sanitize_email($_POST['gdwpm_nama_service']); 
  45. $gdwpm_opt_kunci_rhs = esc_url($_POST['gdwpm_kunci_rhs']); 
  46.  
  47. $gdwpm_opt_akun = array($gdwpm_opt_imel, $gdwpm_opt_klaen_aidi, $gdwpm_opt_nama_service, $gdwpm_opt_kunci_rhs); 
  48.  
  49. if (!EMPTY($gdwpm_opt_imel) && !EMPTY($gdwpm_opt_klaen_aidi) && !EMPTY($gdwpm_opt_nama_service) && !EMPTY($gdwpm_opt_kunci_rhs)) 
  50. // test akun  
  51. if(!isset($gdwpm_service)) {  
  52. $gdwpm_service = new GDWPMBantuan( $gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3] );  
  53. try { 
  54. $gdwpm_apiConfig['use_objects'] = true; 
  55. $ebot = $gdwpm_service->getAbout(); 
  56. update_option('gdwpm_akun_opt', $gdwpm_opt_akun); 
  57. update_option('gdwpm_img_thumbs', array('', '', '150', '150', 'false')); 
  58. echo '<div class="updated"><p>API settings successfully saved.</p></div>'; 
  59. } catch (Exception $errorkon) { 
  60. $cek_kunci = 'true'; 
  61. echo '<div class="error"><p>Anerroroccurred: ' . wp_strip_all_tags($errorkon->getMessage()) . '. Your settings could not be saved.</p></div>'; 
  62. }  
  63. }else{ 
  64. echo '<div class="error"><p>All fields are required. Your settings could not be saved.</p></div>'; 
  65. if(!isset($gdwpm_opt_akun)) {$gdwpm_opt_akun = get_option('gdwpm_akun_opt');} // imel, client id, gdwpm_service akun, private key 
  66. if($gdwpm_opt_akun) { 
  67. if (!EMPTY($gdwpm_opt_akun[0]) && !EMPTY($gdwpm_opt_akun[1]) && !EMPTY($gdwpm_opt_akun[2]) && !EMPTY($gdwpm_opt_akun[3])) 
  68. $cek_kunci = 'false'; 
  69. //$gdwpm_apiConfig['use_objects'] = true; 
  70. if(!isset($gdwpm_service)) {  
  71. $gdwpm_service = new GDWPMBantuan( $gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3] );  
  72.  
  73. if(isset($_POST['gdwpm_opsi_thumbs_nonce'])) { 
  74. require_once(ABSPATH .'wp-includes/pluggable.php'); 
  75. if(!wp_verify_nonce( $_POST['gdwpm_opsi_thumbs_nonce'], 'gdwpm_thumbs_nonce' )) { 
  76. wp_die( '<div class="error"><p>Security check not verified!</p></div>' );  
  77. } else { 
  78. if(ctype_digit($_POST['gdwpm_thumbs_width']) && ctype_digit($_POST['gdwpm_thumbs_height'])) { 
  79. if (isset($_POST['gdwpm_cekbok_opsi_thumbs'])) {$ceket = 'checked';}else{$ceket = '';} 
  80. if(isset($_POST['gdwpm_thumbs_crop']) == 'true') {$gdwpm_thumbs_crop = 'true';}else{$gdwpm_thumbs_crop = 'false';} 
  81. $gdwpm_opsi_thumbs = get_option('gdwpm_img_thumbs'); 
  82. if(is_array($gdwpm_opsi_thumbs) && !empty($gdwpm_opsi_thumbs[1])) { 
  83. update_option('gdwpm_img_thumbs', array($ceket, $gdwpm_opsi_thumbs[1], $_POST['gdwpm_thumbs_width'], $_POST['gdwpm_thumbs_height'], $gdwpm_thumbs_crop));  
  84. echo '<div class="updated"><p>Thumbnail settings successfully saved.</p></div>';  
  85. }else{ 
  86. $folderId_thumb = $gdwpm_service->getFolderIdByName( 'gdwpm-thumbnails' ); 
  87. if(!$folderId_thumb) { 
  88. $folderId_thumb = $gdwpm_service->createFolder( 'gdwpm-thumbnails' ); 
  89. if($folderId_thumb) { 
  90. $gdwpm_service->setPermissions( $folderId_thumb, $gdwpm_opt_akun[0] ); 
  91. }else{ 
  92. $folderId_thumb = ''; 
  93. }  
  94. update_option('gdwpm_img_thumbs', array($ceket, $folderId_thumb, $_POST['gdwpm_thumbs_width'], $_POST['gdwpm_thumbs_height'], $gdwpm_thumbs_crop)); 
  95. echo '<div class="updated"><p>Thumbnail settings successfully saved.</p></div>'; 
  96. }else{ 
  97. echo '<div class="error"><p>Thumbnail settings error, only numeric can be accepted.</p></div>'; 
  98. }  
  99.  
  100. if (isset($_POST['repair_folder_pilian'])) 
  101. if (isset($_POST['gdwpm_folder_tools_nonce'])) 
  102. $nonce = $_POST['gdwpm_folder_tools_nonce']; 
  103. if ( ! wp_verify_nonce( $nonce, 'gdwpm_folder_tools_nonce' ) ) { 
  104. wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');  
  105. }else{ 
  106. $folderId = $_POST['repair_folder_pilian']; 
  107. $gdwpm_folder_permisi = $gdwpm_service->setPermissions( $folderId, $gdwpm_opt_akun[0] ); 
  108.  
  109. if($gdwpm_folder_permisi) { 
  110. echo '<div class="updated"><p>Folder <strong>'.$folderId.'</strong> permissions changed.</p></div>'; 
  111. }else{ 
  112. echo '<div class="error"><p>Folder '.$folderId.' permissions fail to change.</p></div>'; 
  113. }else{ 
  114. wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>'); 
  115.  
  116. if (isset($_POST['buang_folder_pilian'])) 
  117. if (isset($_POST['gdwpm_folder_tools_nonce'])) 
  118. $nonce = $_POST['gdwpm_folder_tools_nonce']; 
  119. if ( ! wp_verify_nonce( $nonce, 'gdwpm_folder_tools_nonce' ) ) { 
  120. wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');  
  121. }else{ 
  122. $gdwpm_nama_folder = $gdwpm_service->getNameFromId( $_POST['buang_folder_pilian'] ); 
  123. $gdwpm_tong_sampah = $gdwpm_service->buangFile( $_POST['buang_folder_pilian'] ); 
  124. if($gdwpm_tong_sampah) { 
  125. echo '<div class="updated"><p>Folder <strong>'.$_POST['buang_folder_pilian'].' '.$gdwpm_nama_folder.'</strong> successfully deleted.</p></div>'; 
  126. sleep(3); 
  127. }else{ 
  128. echo '<div class="error"><p>' . $_POST['buang_folder_pilian'] . ' ' . $gdwpm_nama_folder . ' fail to delete.</p></div>'; 
  129. }else{ 
  130. wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>'); 
  131.  
  132. if (isset($_POST['gdwpm_buang_berkas_terpilih'])) 
  133. if (isset($_POST['gdwpm_folder_tools_nonce'])) 
  134. $nonce = $_POST['gdwpm_folder_tools_nonce']; 
  135. if ( ! wp_verify_nonce( $nonce, 'gdwpm_folder_tools_nonce' ) ) { 
  136. wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');  
  137. }else{ 
  138. $gdwpm_info_files = ''; 
  139. if (is_array($_POST['gdwpm_buang_berkas_terpilih'])) { 
  140. foreach($_POST['gdwpm_buang_berkas_terpilih'] as $value) { 
  141. //$gdwpm_berkas_terpilih_array = explode(' | ', $value); // mime, name, id, desc, folder, pptis 
  142. $gdwpm_berkas_terpilih_array = json_decode(base64_decode($value), true); 
  143. $gdwpm_tong_sampah = $gdwpm_service->buangFile( $gdwpm_berkas_terpilih_array[2] ); 
  144. if($gdwpm_tong_sampah) { 
  145. $gdwpm_info_files .= '<strong>' . $gdwpm_berkas_terpilih_array[1] . '</strong> deleted, '; 
  146. }else{ 
  147. $gdwpm_info_files .= '<strong>' . $gdwpm_berkas_terpilih_array[1] . '</strong> failed, '; 
  148. //sleep(0.5); 
  149. } else { 
  150. //$gdwpm_berkas_terpilih_array = explode(' | ', $_POST['gdwpm_buang_berkas_terpilih']); // mime, name, id, desc, folder, pptis 
  151. $gdwpm_berkas_terpilih_array = json_decode(base64_decode($_POST['gdwpm_buang_berkas_terpilih']), true); 
  152. $gdwpm_tong_sampah = $gdwpm_service->buangFile( $gdwpm_berkas_terpilih_array[2] ); 
  153. if($gdwpm_tong_sampah) { 
  154. $gdwpm_info_files = '<strong>' . $gdwpm_berkas_terpilih_array[1] . '</strong> deleted, '; 
  155. }else{ 
  156. $gdwpm_info_files = '<strong>' . $gdwpm_berkas_terpilih_array[1] . '</strong> failed, '; 
  157. echo '<div class="updated"><p>'.$gdwpm_info_files.'.. Done!.</p></div>'; 
  158. sleep(3); 
  159. }else{ 
  160. wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>'); 
  161.  
  162. if (isset($_POST['gdwpm_gawe_folder_nonce'])) 
  163. require_once(ABSPATH .'wp-includes/pluggable.php'); 
  164. $nonce = $_POST['gdwpm_gawe_folder_nonce']; 
  165. if ( ! wp_verify_nonce( $nonce, 'gdwpm_gawe_folder_nonce' ) ) { 
  166. die('<div class="error"><p>Oops.. security check is not ok!</p></div>');  
  167.  
  168. } else { 
  169. if (!EMPTY($_POST['gdwpm_gawe_folder'])) 
  170. $gawe_folder = preg_replace("/[^a-zA-Z0-9]+/", " ", $_POST['gdwpm_gawe_folder']); 
  171. $gawe_folder = sanitize_text_field($gawe_folder); 
  172. $folderId = $gdwpm_service->createFolder( $gawe_folder ); 
  173. $gdwpm_folder_permisi = $gdwpm_service->setPermissions( $folderId, $gdwpm_opt_akun[0] ); 
  174.  
  175. if( $gdwpm_folder_permisi ) { 
  176. echo '<div class="updated"><p>Great! Folder name <strong>'.$gawe_folder.'</strong> successfully created.</p></div>'; 
  177. }else{ 
  178. echo '<div class="error"><p>Folder '.$gawe_folder.' created but permission fail to change.</p></div>'; 
  179. }else{ 
  180. echo '<div class="error"><p>Folder name cannot be empty!</p></div>'; 
  181.  
  182. ?> 
  183. <script> 
  184. jQuery(function() { 
  185. var icons = { 
  186. header: "ui-icon-triangle-1-e",  
  187. activeHeader: "ui-icon-lightbulb" 
  188. }; 
  189. jQuery( "#accordion" ).accordion({ 
  190. heightStyle: "content",  
  191. icons: icons 
  192. }); 
  193.  
  194. jQuery("[title]").tooltip({  
  195. track: true,  
  196. show: { effect: 'slideDown' },  
  197. open: function (event, ui) { setTimeout(function () { 
  198. jQuery(ui.tooltip).hide('explode'); 
  199. }, 3000); } 
  200. }); 
  201.  
  202. jQuery( "#tabs" ).tabs({ 
  203. beforeLoad: function( event, ui ) { 
  204. ui.jqXHR.error(function() { 
  205. ui.panel.html( 
  206. "Opening Options tab, please wait.. <p>If this take too long, there's something wrong with your internet connection. :)</p>" ); 
  207. }); 
  208. }); 
  209.  
  210. jQuery( "#doktabs" ).tabs({ 
  211. beforeLoad: function( event, ui ) { 
  212. ui.jqXHR.error(function() { 
  213. ui.panel.html( 
  214. "Opening plugin documentation tab, please wait..<p>If this take too long, there's something wrong with your internet connection. :)</p>" ); 
  215. }); 
  216. }); 
  217.  
  218. jQuery( "#gdwpm-settingtabs" ).tabs({ 
  219. beforeLoad: function( event, ui ) { 
  220. ui.jqXHR.error(function() { 
  221. ui.panel.html( 
  222. "Opening Themes Setting tab, please wait..<p>If this take too long, there's something wrong with your internet connection.:)</p>" ); 
  223. }); 
  224. }  
  225. }); 
  226.  
  227. jQuery( "#gdwpm-albums" ).tabs({ 
  228. beforeLoad: function( event, ui ) { 
  229. ui.jqXHR.error(function() { 
  230. ui.panel.html( 
  231. "Opening Albums tab, please wait..<p>If this take too long, there's something wrong with your internet connection. :)</p>" ); 
  232. }); 
  233. }  
  234. }); 
  235. }); 
  236. </script> 
  237. <style type="text/css"> 
  238. a.tabeksen:link { 
  239. color: #3399FF ; 
  240. a.tabeksen:hover { 
  241. color: #FF0000; 
  242. #box-table-a 
  243. font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; 
  244. font-size: 12px; 
  245. width:100%; 
  246. text-align: left; 
  247. border-collapse: collapse; 
  248. #box-table-a th 
  249. font-size: 13px; 
  250. font-weight: normal; 
  251. padding: 8px; 
  252. background: #B6F0F6; 
  253. border-top: 4px solid #DAF8FB; 
  254. border-bottom: 1px solid #fff; 
  255. color: #039; 
  256. #box-table-a td 
  257. padding: 8px; 
  258. background: #EAFAFC;  
  259. border-bottom: 1px solid #fff; 
  260. color: #669; 
  261. border-top: 1px solid transparent; 
  262. #box-table-a tr:hover td 
  263. background: #FFFFCF; 
  264. color: #339; 
  265.  
  266. div.halpager { 
  267. text-align: center; 
  268. margin: 1em 0; 
  269.  
  270. div.halpager span { 
  271. display: inline-block; 
  272. width: 1.8em; 
  273. height: 1.8em; 
  274. line-height: 1.8; 
  275. text-align: center; 
  276. cursor: pointer; 
  277. background: #EAFAFC; 
  278. color: #039; 
  279. margin-right: 0.5em; 
  280.  
  281. div.halpager span.active { 
  282. background: #B6F0F6; 
  283. #pilihMaxRes { width: 110px; } 
  284. #pilihMaxResdel { width: 140px; } 
  285. #pilihMaxResgal { width: 140px; } 
  286. #folder_pilian{ width: 200px; } 
  287. .overflowpil { max-height: 370px; } 
  288. #folder_pilian_aplod { width: 190px; } 
  289. .overflowapl { max-height: 360px; } 
  290. #buang_folder_pilian { width: 230px; } 
  291. .overflowbua { max-height: 300px; } 
  292. #repair_folder_pilian { width: 230px; } 
  293. .overflowrep { max-height: 300px; } 
  294. #folder_pilian_file_del { width: 220px; } 
  295. .overflowdel { max-height: 360px; } 
  296. #folder_pilian_file_gal { width: 220px; } 
  297. .overflowgal { max-height: 370px; } 
  298. #old_album { width: 180px; } 
  299. .overflowolal { max-height: 370px; } 
  300. #css_style, #css_style_default, #css_justified_margins, #css_justified_row, #css_justified_last { width: 120px; } 
  301. #css_effect, #gallery_jquery { width: 140px; }  
  302. h2:before { content: ""; display: block; background: url("<?php echo plugins_url( '/images/animation/icon-32x32.png', __FILE__ );?>") no-repeat; width: 32px; height: 32px; float: left; margin: 0 6px 0 15px; } 
  303. #itemgal { margin: 5px 10px 5px 0; padding: 5px; float: left; width: 160px; text-align: center; } 
  304. #itemgal img { height: 150px; width="auto"; } 
  305. #itemgal input { margin-top: 5px; } 
  306. </style> 
  307. <?php 
  308. $gdwpm_apiConfig['use_objects'] = true; 
  309.  
  310. if($gdwpm_opt_akun && !isset($errorkon)) { 
  311. if (!EMPTY($gdwpm_opt_akun[0]) && !EMPTY($gdwpm_opt_akun[1]) && !EMPTY($gdwpm_opt_akun[2]) && !EMPTY($gdwpm_opt_akun[3])) 
  312. // cek dolo sbagai awal dr smuanya :p 
  313. try { 
  314. $parameters = array('q' => "mimeType = 'application/vnd.google-apps.folder'", 'maxResults' => 50); 
  315. $files = $gdwpm_service->files->listFiles($parameters); 
  316. $folderpil = '<select id="folder_pilian" name="folder_pilian">'; 
  317. $foldercek = array(); 
  318. foreach( $files->getItems() as $item ) 
  319. {//description, title 
  320. if('gdwpm-thumbnails' == $item->getTitle()) {$selek = ' disabled';}else{$selek = '';} 
  321. $folderpil .= '<option value="'.$item->getId().'"'.$selek.'>'.$item->getTitle().'</option>'; 
  322. $foldercek[] = $item->getTitle();  
  323. $folderpil .= '</select>'; 
  324. $foldercek = array_filter($foldercek); 
  325.  
  326. if (empty($foldercek)) { 
  327. $folderpil = ''; 
  328. } catch (Exception $e) { 
  329. $cek_kunci = 'true'; 
  330. echo '<div class="error"><p>Anerroroccurred: ' . wp_strip_all_tags($e->getMessage()) . '</p></div>'; 
  331. }  
  332. }else{ 
  333. $cek_kunci = 'true'; 
  334. ?> 
  335. <div id="accordion" style="margin:10px 10px 5px 10px;"> 
  336. <?php 
  337. //cek versi php 
  338. $gdwpm_cek_php = 'true'; 
  339. if(version_compare(PHP_VERSION, MINPHP_GDWPM) >= 0) { 
  340. $gdwpm_cek_php = 'false'; 
  341. global $cek_kunci; 
  342. if($cek_kunci == 'false') { ?> 
  343. <h3>My Google Drive</h3> 
  344. <div> 
  345. <?php 
  346. $gdwpm_tab_opsi_nonce = wp_create_nonce( "gdwpm_tab_opsi_key" ); 
  347. $gdwpm_url_tab_opsi = admin_url( 'admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=opsyen&gdwpm_tab_opsi_nonce=') . $gdwpm_tab_opsi_nonce; 
  348. $gdwpm_url_tab_info = admin_url( 'admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=infosyen&gdwpm_tab_info_nonce=') . $gdwpm_tab_opsi_nonce; 
  349. ?> 
  350. <div id="tabs" style="margin:0 -12px 0 -12px;"> 
  351. <ul> 
  352. <?php if (!empty($foldercek)) { ?> 
  353. <li><a href="#tabs-1"><span style="float:left" class="ui-icon ui-icon-script"></span> File & Folder List</a></li> 
  354. <li><a href="#tabs-2"><span style="float:left" class="ui-icon ui-icon-star"></span> Upload</a></li> 
  355. <li><a href="<?php echo $gdwpm_url_tab_opsi; ?>"><span style="float:left" class="ui-icon ui-icon-clipboard"></span> Options</a></li> 
  356. <li><a href="<?php echo $gdwpm_url_tab_info; ?>"><span style="float:left" class="ui-icon ui-icon-heart"></span> Account Information</a></li> 
  357. <li><a href="#tabs-5"><span style="float:left" class="ui-icon ui-icon-gear"></span> Tools</a></li> 
  358. <?php }else{ ?> 
  359. <li><a href="#tabs-6"><span style="float:left" class="ui-icon ui-icon-folder-collapsed"></span> Create Folder</a></li> 
  360. <?php } ?> 
  361. </ul> 
  362. <?php if (!empty($foldercek)) { ?> 
  363. <div id="tabs-1" class="ui-helper-clearfix"> 
  364. <div id="tombol-donat" class="ui-widget-content ui-corner-all" style="width:190px; float:right; padding:1em;">  
  365. <p style="text-align: center;">Do you like this plugin?<br/>Please consider to:<br/><br/><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZZNNMX3NZM2G2" target="_blank"> 
  366. <img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt="Donate Button with Credit Cards" /></a><br/>or<br/><a href="https://wordpress.org/support/view/plugin-reviews/google-drive-wp-media?filter=5" target="_blank"><img src="<?php echo plugins_url( '/images/animation/5star-rating.png', __FILE__ );?>" alt="5 Star Rating" title="5 Star Rating" /></a><br/>Your supports help the plugin keep updated & maintained. 
  367. </p> 
  368. </div> 
  369. <p style="display: flex; align-items: center;">Select folder:  <?php echo str_replace(' disabled', '', $folderpil); ?>  <select id="pilihMaxRes"> 
  370. <?php for($i=1;$i<=10;$i++) {$inum = $i * 10;?> 
  371. <option value="<?php echo $inum;?>"><?php echo $inum;?> items/page</option>  
  372. <?php } ?> 
  373. </select>  <button id="golek_seko_folder" name="golek_seko_folder"><?php _e('Get Files') ?></button>    
  374. <span id="gdwpm_info_folder_baru" style="display:none;"> 
  375. There's a new folder. 
  376. <a href=""><button id="gdwpm_tombol_info_folder_baru" name="gdwpm_tombol_info_folder_baru"><?php _e('Reload Now') ?></button></a> 
  377. </span> 
  378. <?php add_thickbox(); $gdwpm_ukuran_preview = get_option('gdwpm_ukuran_preview');?> 
  379. <p> 
  380. <span class="sukses">Please select folder and click Get Files, to show all files belongs to it.<br /><br /> 
  381. <?php 
  382. if(!isset($gdwpm_old_version)) {$gdwpm_old_version = get_option('gdwpm_version');} 
  383. if($gdwpm_old_version != VERSI_GDWPM) { 
  384. ?> 
  385. <div class="ui-state-error ui-corner-all" style="padding:0.7em;width:70%;"> 
  386. <p><span class="ui-icon ui-icon-alert" style="float:left; margin-right: .3em;"></span> 
  387. <b>Alert:</b> This plugin did not upgrade properly. Please go to <a href="plugins.php">plugins page</a> and try to deactivate and reactivate it.</p> 
  388. </div><br /> 
  389. <?php } ?> 
  390. <dfn>New</dfn> Auto create thumbnails and Chunking Option available, just navigate to the Options page and customize your settings to help suit your needs.<br/> 
  391. Shortcode: <code>[gdwpm id="<strong>GOOGLE-DRIVE-FILE-ID</strong>"]</code> 
  392. <br /> 
  393. Shortcode with specific width & height: <code>[gdwpm id="<strong>GOOGLE-DRIVE-FILE-ID</strong>" w="<strong><?php echo $gdwpm_ukuran_preview[0];?></strong>" h="<strong><?php echo $gdwpm_ukuran_preview[1];?></strong>"]</code> 
  394. <br /> 
  395. Shortcode for embed video: <code>[gdwpm id="<strong>GOOGLE-DRIVE-FILE-ID</strong>" video="<strong><?php echo $gdwpm_ukuran_preview[3];?></strong>" w="<strong><?php echo $gdwpm_ukuran_preview[4];?></strong>" h="<strong><?php echo $gdwpm_ukuran_preview[5];?></strong>"]</code> 
  396. <br/> 
  397. Link URL: https://docs.google.com/uc?id=<code><strong>GOOGLE-DRIVE-FILE-ID</strong></code>&export=view <br/> 
  398. or: <s>https://www.googledrive.com/host/<code><strong>GOOGLE-DRIVE-FILE-ID</strong></code></s> 
  399. <br /> 
  400. Preview: https://docs.google.com/file/d/<code><strong>GOOGLE-DRIVE-FILE-ID</strong></code>/preview 
  401. <br/><small> 
  402. * Replace <code><strong>GOOGLE-DRIVE-FILE-ID</strong></code> with your file ID.  
  403. <?php 
  404. if(!isset($ebot)) {$ebot = $gdwpm_service->getAbout();} 
  405. echo '<br /><br />Total quota: '.size_format($ebot->getQuotaBytesTotal(), 2).'<br /> 
  406. Quota Used: '.size_format($ebot->getQuotaBytesUsed(), 2).'</small>'; 
  407. ?> 
  408. </span> 
  409. </p>  
  410. <div style="display: none" id="gdwpm_loading_gbr"> 
  411. <center><img src="<?php echo plugins_url( '/images/animation/gdwpm_loader_256.gif', __FILE__ );?>" /><br />Please wait...</center> 
  412. </div> 
  413. <div id="hasil"></div> 
  414. <div id="vaginasi" style="text-align:center;margin-top:25px;"></div> 
  415. <div style="display: none" id="gdwpm_masuk_perpus_teks"><p>Pick a file to include it in the Media Library.  
  416. <?php 
  417. if(!isset($gdwpm_dummy_fol)) { $gdwpm_dummy_fol = get_option('gdwpm_dummy_folder');} 
  418. if(isset($gdwpm_dummy_fol['status']) && $gdwpm_dummy_fol['status'] == 'checked') { 
  419. $txtpref = 'disabled'; 
  420. if($gdwpm_dummy_fol['pref'] == 'checked') {$txtpref = '';} 
  421. ?> 
  422. <small style="display:none;float:right;" id="gdwpm_masuk_perpus_img">Override default options:  
  423. Virtual folder: <select style="width: 100px;" name="gdwpm_opsi_dummy_dirov" id="gdwpm_opsi_dummy_dirov"> 
  424. <?php foreach($gdwpm_dummy_fol['dirlist'] as $dirfol) { ?> 
  425. <option value="<?php echo $dirfol;?>" <?php if($dirfol == $gdwpm_dummy_fol['dirname']) {echo ' selected="selected"';}?>><?php echo $dirfol;?></option> 
  426. <?php } ?> 
  427. </select>  
  428. Rewrite filename: <input type="text" size="20" name="gdwpm_perpus_img_fname" id="gdwpm_perpus_img_fname" value="" placeholder="new-filename" <?php echo $txtpref;?>>  
  429. </small> 
  430. <?php } ?> 
  431. </p><p> 
  432. <button id="gdwpm_berkas_masuk_perpus" name="gdwpm_berkas_masuk_perpus">Add to Media Library</button>     
  433. <span style="display: none" id="gdwpm_add_to_media_gbr"> 
  434. <img src="<?php echo plugins_url( '/images/animation/loading-bar-image.gif', __FILE__ );?>" /> 
  435. </span> 
  436. <span id="gdwpm_info_masuk_perpus"></span> 
  437. </p> 
  438. </div> 
  439. <div style="display: none" id="gdwpm_info_folder_thumbs"> 
  440. <p>These thumbnails automatically attached to the Media Library along with their original images respectively.</p> 
  441. </div> 
  442. </div> 
  443. <div id="tabs-2"> 
  444. <p style="display: flex; align-items: center;"> 
  445. Select folder:  <?php echo str_replace('folder_pilian', 'folder_pilian_aplod', $folderpil); ?>  or create a new folder: <input type="text" id="gdwpm_folder_anyar" name="gdwpm_folder_anyar" value="" size="20" title="Ignore this field if you wish to use existing folder" placeholder="*Alphanumeric only"> 
  446. </p> 
  447. <!--<p>Short Description: <input type="text" name="gdwpm_aplod_deskrip" value="" size="65" placeholder="Optional"></p>--> 
  448. <p> 
  449. <ul> 
  450. <li id="infopraupload"><dfn>Your Uploaded files will be listed in "Shared with Me" view (https://drive.google.com/?authuser=0#shared-with-me) in the classic Google Drive UI or "Shared with Me" area (https://drive.google.com/drive/shared-with-me) in the new Google Drive UI. 
  451. </dfn></li> 
  452. <li><dfn>Accepted Media MIME types: */*</dfn> 
  453. <!-- <br /> <dfn>All Filetypes are allowed.</dfn> 
  454. --></li> 
  455. </ul>  
  456. </p> 
  457.  
  458. <?php 
  459. $gdwpm_opsi_chunk = get_option('gdwpm_opsi_chunk'); 
  460. if(!$gdwpm_opsi_chunk || empty($gdwpm_opsi_chunk)) { 
  461. $gdwpm_opsi_chunk = array('local' => array('cekbok' => 'checked', 'chunk' => '700', 'retries' => '3'), 'drive' => array('cekbok' => 'checked', 'chunk' => '2', 'retries' => '3')); 
  462. update_option('gdwpm_opsi_chunk', $gdwpm_opsi_chunk); 
  463. $gdwpm_satpam_buat_nonce = wp_create_nonce( 'gdwpm_satpam_aplod_berkas' ); 
  464. ?>  
  465. <ul id="filelist"></ul> 
  466. <br /> 
  467. <button id="gdwpm_tombol_bersih" style="display:none;float:right;">Clear List</button> 
  468. <br /> 
  469. <br /> 
  470. <pre id="console"></pre> 
  471. <div id="gdwpm_upload_container"><p id="gdwpm-pilih-kt">Choose your files:  
  472. <a id="gdwpm_tombol_browse" href="javascript:;"><button id="gdwpm_tombol_bk_folder">Browse</button></a></p> 
  473. <input type='checkbox' id='gdwpm_cekbok_masukperpus' name='gdwpm_cekbok_masukperpus' value='1' checked /> Add to Media Library. (just linked to, all files still remain in Google Drive)<!-- (Image only: <i>*.jpg, *.jpeg, *.png, & *.gif</i>)--><p> 
  474. <?php 
  475. if(!isset($gdwpm_dummy_fol)) { $gdwpm_dummy_fol = get_option('gdwpm_dummy_folder');} 
  476. if(isset($gdwpm_dummy_fol['status']) == 'checked') {  
  477. ?> 
  478. <small style="float:right;">Options for dummy images are Virtual folder: <?php echo $gdwpm_dummy_fol['dirname'];?>,  
  479. pattern: #<?php echo $gdwpm_dummy_fol['pattern'];?>, and  
  480. description as filename: <?php echo empty($gdwpm_dummy_fol['pref']) ? " no" : " yes";?> 
  481. </small> 
  482. <?php } ?> 
  483. <a style="display:none;" id="gdwpm_start-upload" href="javascript:;"><button id="gdwpm_tombol_upload">Upload to Google Drive</button></a> 
  484. </div> 
  485. <div id="gdwpm_loding_128" style="display:none;"><center> 
  486. <img src="<?php echo plugins_url( '/images/animation/gdwpm_loader_128.gif', __FILE__ );?>"><br/>Uploading...<br/><small id="respon_progress"></small></center></div> 
  487.  
  488. <script type="text/javascript">  
  489. var uploader = new plupload.Uploader({ 
  490. browse_button: 'gdwpm_tombol_browse',  
  491. url: '<?php echo admin_url( 'admin-ajax.php?action=gdwpm_on_action&gdwpm_nonce_aplod_berkas=') . $gdwpm_satpam_buat_nonce; ?>',  
  492. <?php if($gdwpm_opsi_chunk['local']['cekbok'] == 'checked') {echo "chunk_size: '".$gdwpm_opsi_chunk['local']['chunk']."kb', ";}?> 
  493. max_retries: <?php echo $gdwpm_opsi_chunk['local']['retries'];?> 
  494. }); 
  495.  
  496. uploader.init(); 
  497.  
  498. uploader.bind('FilesAdded', function(up, files) { 
  499. var html = ''; 
  500. plupload.each(files, function(file) { 
  501. html += '<li id="' + file.id + '"><code>' + file.name + '</code> (' + plupload.formatSize(file.size) + ') <span class="hasilprog"></span> <input type="text" id="' + file.id + 'gdwpm_aplod_deskrip" name="' + file.id + 'lod_deskrip" value="" size="55" placeholder="Short Description (optional) *Alphanumeric*"><hr></li>'; 
  502. }); 
  503.  
  504. document.getElementById('filelist').innerHTML += html; 
  505. jQuery('#console').empty(); 
  506. jQuery('#gdwpm_tombol_bersih').hide(); 
  507. jQuery('#gdwpm_start-upload').show(); 
  508. jQuery('#infopraupload').remove(); 
  509. }); 
  510.  
  511. uploader.bind('UploadProgress', function(up, file) { 
  512. document.getElementById(file.id).getElementsByClassName('hasilprog')[0].innerHTML = "<dfn>" + file.percent + "%</dfn> <small>" + jQuery('#' + file.id + 'gdwpm_aplod_deskrip').val().replace(/[^\w\s-]/gi, '') + "</small>"; 
  513.  
  514. jQuery('#' + file.id + 'gdwpm_aplod_deskrip').hide(); 
  515. jQuery('#gdwpm_upload_container').hide(); 
  516. jQuery('#gdwpm_loding_128').show(); 
  517. jQuery('#gdwpm_tombol_bersih').hide(); 
  518. }); 
  519.  
  520. uploader.bind('Error', function(up, err) { 
  521. document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message; 
  522.  
  523. jQuery('#gdwpm_upload_container').show(); 
  524. jQuery('#gdwpm_loding_128').hide(); 
  525. jQuery('#gdwpm_start-upload').hide(); 
  526. jQuery('#gdwpm_tombol_bersih').show(); 
  527. }); 
  528.  
  529. document.getElementById('gdwpm_start-upload').onclick = function() { 
  530. uploader.start(); 
  531. }; 
  532.  
  533. uploader.bind('FileUploaded', function(up, file, response ) { 
  534. response=response["response"]; 
  535. jQuery('#console').html(response); 
  536.  
  537. var totalspan = document.getElementById('filelist').getElementsByClassName('hasilprog').length; 
  538. var totaldfn = document.getElementById('filelist').getElementsByTagName('dfn').length; 
  539. if(totalspan == totaldfn) { 
  540. jQuery('#gdwpm_upload_container').show(); 
  541. jQuery('#gdwpm_tombol_bersih').show(); 
  542. jQuery('#gdwpm_loding_128').hide(); 
  543. jQuery('#gdwpm_start-upload').hide(); 
  544. jQuery('#respon_progress').empty(); 
  545.  
  546. if(jQuery('#gdwpm_folder_anyar').val() != '') { 
  547. jQuery('#gdwpm_info_folder_baru').show(); 
  548. }); 
  549.  
  550. uploader.bind('BeforeUpload', function (up, file) { 
  551. up.settings.multipart_params = {gdpwm_nm_bks: jQuery("#folder_pilian_aplod option:selected").text(), gdpwm_nm_id: jQuery('select[name=folder_pilian_aplod]').val(),  
  552. gdpwm_nm_br: jQuery('#gdwpm_folder_anyar').val(), gdpwm_sh_ds: jQuery('#' + file.id + 'gdwpm_aplod_deskrip').val().replace(/[^\w\s-]/gi, ''), gdpwm_med_ly: jQuery('#gdwpm_cekbok_masukperpus:checked').val(),  
  553. gdpwm_nama_file: file.name}; 
  554. });  
  555.  
  556. uploader.bind('ChunkUploaded', function(up, file, info) { 
  557. response=info["response"]; 
  558. jQuery('#respon_progress').empty(); 
  559. jQuery('#console').html(response); 
  560. jQuery('#respon_progress').html('[Chunked: ' + info["offset"] + ' of ' + info["total"] + ' bytes]'); 
  561.  
  562. //jQuery('#gdwpm_upload_container').show(); 
  563. //jQuery('#gdwpm_loding_128').hide(); 
  564. //jQuery('#gdwpm_start-upload').hide(); 
  565. });  
  566. </script> 
  567. </div> 
  568. <!-- tabs-3 ajax --> 
  569. <!-- tabs-4 ajax --> 
  570. <div id="tabs-5"> 
  571. <?php $gdwpm_folder_tools_nonce = wp_create_nonce( "gdwpm_folder_tools_nonce" ); ?> 
  572. <div id="gdwpm_repair_folder" class="ui-widget-content ui-corner-all " style="padding:1em;">  
  573. <div class="ui-corner-all ui-widget-header" style="padding:0.5em;text-align:center;">Repair Folder 
  574. </div> 
  575. <form id="gdwpm_form_repair_folder" name="gdwpm_form_repair_folder" method="post"> 
  576. <p style="margin-left:7px;"> 
  577. <dfn>If you found that your folder was listed here, but not in your Google Drive "Share with me" area. <br/> 
  578. Then, this tool will fix your hidden folder by change its permissions.</dfn> 
  579. </p><br/> 
  580. <input type="hidden" name="gdwpm_folder_tools_nonce" value="<?php echo $gdwpm_folder_tools_nonce;?>"> 
  581. <p style="margin-left:17px;display: flex; align-items: center;">Select folder:  <?php echo str_replace(array('folder_pilian', ' disabled'), array('repair_folder_pilian', ''), $folderpil); ?>  <button id="gdwpm_tombol_repair_folder" name="gdwpm_tombol_repair_folder"><?php _e('Fix Now!') ?></button>    
  582. </p> 
  583. </form> 
  584. </div> 
  585. <br/> 
  586. <div class="ui-widget-content ui-corner-all" style="padding:1em;">  
  587. <div class="ui-corner-all ui-widget-header" style="padding:0.5em;text-align:center;">Delete Folder and Files 
  588. </div> 
  589. <p>What do you want to do?</p> 
  590. <p style="margin-left:17px;"><a onclick="gdwpm_cekbok_opsi_buang_folder_eksen();"><input type='radio' name='gdwpm_cekbok_opsi_buang_folder' value='1' /></a>  
  591. Delete folder</p> 
  592. <p style="margin-left:17px;"><a onclick="gdwpm_cekbok_opsi_buang_file_eksen();"><input type='radio' name='gdwpm_cekbok_opsi_buang_folder' value='1' /></a>  
  593. Delete files</p> 
  594. <br /> 
  595. <div id="gdwpm_kotak_buang_folder" class="ui-widget-content ui-corner-all" style="padding:1em;display:none;">  
  596. <div class="ui-corner-all ui-widget-header" style="padding:0.5em;text-align:center;">Delete Folder 
  597. </div> 
  598. <form id="gdwpm_form_buang_folder" name="gdwpm_form_buang_folder" method="post"> 
  599. <input type="hidden" name="gdwpm_folder_tools_nonce" value="<?php echo $gdwpm_folder_tools_nonce;?>"> 
  600. <p style="display: flex; align-items: center;">Select folder to delete:  <?php echo str_replace('folder_pilian', 'buang_folder_pilian', $folderpil); ?>  <button id="gdwpm_buang_folder" name="gdwpm_buang_folder"><?php _e('Delete Now') ?></button>    
  601. </form> 
  602. </p> 
  603. </div> 
  604. <div id="gdwpm_kotak_buang_file" class="ui-widget-content ui-corner-all" style="padding:1em;display:none;">  
  605. <div class="ui-corner-all ui-widget-header" style="padding:0.5em;text-align:center;">Delete Files 
  606. </div>  
  607. <p style="display: flex; align-items: center;">Select folder:  <?php echo str_replace(array('folder_pilian', ' disabled'), array('folder_pilian_file_del', ''), $folderpil); ?>  <select id="pilihMaxResdel"> 
  608. <?php for($i=1;$i<=10;$i++) {$inum = $i * 10;?> 
  609. <option value="<?php echo $inum;?>"><?php echo $inum;?> items/page</option>  
  610. <?php } ?> 
  611. </select>  <button id="gdwpm_file_dr_folder" name="gdwpm_file_dr_folder"><?php _e('Get Files') ?></button>    
  612.  
  613. <p> 
  614. <span class="sukses_del">Please select folder and click Get Files, to show all files belongs to it. 
  615. </span> 
  616. </p> 
  617.  
  618. <div style="display: none" id="gdwpm_loading_gbr_del"> 
  619. <center><img src="<?php echo plugins_url( '/images/animation/gdwpm_loader_256.gif', __FILE__ );?>" /><br />Please wait...</center> 
  620. </div> 
  621. <form id="gdwpm_form_buang_berkas" name="gdwpm_form_buang_berkas" method="post">  
  622. <input type="hidden" name="gdwpm_folder_tools_nonce" value="<?php echo $gdwpm_folder_tools_nonce;?>"> 
  623. <div id="hasil_del"></div> 
  624. <div style="display: none" id="gdwpm_info_del"><p>Selected file(s) will be permanently deleted. Are you ready?</p> 
  625. <p> 
  626. <button id="gdwpm_berkas_buang" name="gdwpm_berkas_buang">Delete Selected</button> 
  627. </p> 
  628. </div> 
  629. </form> 
  630. <div id="vaginasi_del" style="text-align:center;margin-top:25px;"></div> 
  631. </div> 
  632. <div id="dialog-buang-folder" title="Confirm Deletion" style="display: none;"> 
  633. <p> 
  634. <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span> 
  635. Are you sure want to delete this folder? 
  636. </p> 
  637. <p> 
  638. All files in this folder will be permanently deleted and cannot be recovered. 
  639. </p> 
  640. </div> 
  641. <div id="dialog-buang-berkas" title="Confirm Deletion" style="display: none;"> 
  642. <p> 
  643. <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span> 
  644. Are you sure want to delete selected file(s)? 
  645. </p> 
  646. <p> 
  647. All selected files will be permanently deleted and cannot be recovered. 
  648. </p> 
  649. </div> 
  650. </div> 
  651. </div> 
  652. <script> 
  653. function gdwpm_cekbok_opsi_buang_folder_eksen() { 
  654. document.getElementById("gdwpm_kotak_buang_folder").style.display = "block"; 
  655. document.getElementById("gdwpm_kotak_buang_file").style.display = "none"; 
  656. function gdwpm_cekbok_opsi_buang_file_eksen() { 
  657. document.getElementById("gdwpm_kotak_buang_file").style.display = "block"; 
  658. document.getElementById("gdwpm_kotak_buang_folder").style.display = "none"; 
  659. jQuery(function() { 
  660. jQuery('#dialog-buang-folder').dialog({ 
  661. autoOpen: false,  
  662. modal: true,  
  663. width: 350,  
  664. resizable: false,  
  665. buttons: { 
  666. "Yes, sure!": function() { 
  667. document.gdwpm_form_buang_folder.submit(); 
  668. },  
  669. "Cancel": function() { 
  670. jQuery(this).dialog("close"); 
  671. }); 
  672.  
  673. jQuery('form#gdwpm_form_buang_folder').submit(function(e) { 
  674. e.preventDefault(); 
  675.  
  676. jQuery('#dialog-buang-folder').dialog('open'); 
  677. }); 
  678.  
  679. jQuery('#dialog-buang-berkas').dialog({ 
  680. autoOpen: false,  
  681. modal: true,  
  682. width: 350,  
  683. resizable: false,  
  684. buttons: { 
  685. "Yes, I do!": function() { 
  686. document.gdwpm_form_buang_berkas.submit(); 
  687. },  
  688. "Cancel": function() { 
  689. jQuery(this).dialog("close"); 
  690. }); 
  691.  
  692. jQuery('form#gdwpm_form_buang_berkas').submit(function(e) { 
  693. e.preventDefault(); 
  694.  
  695. jQuery('#dialog-buang-berkas').dialog('open'); 
  696. }); 
  697. }); 
  698. </script> 
  699. <?php }else{ ?> 
  700. <div id="tabs-6"> 
  701. <p> 
  702. There's no folder exists/detected in the "Incoming" or "Shared with me" area in your Google Drive or this current user (<?php echo $gdwpm_opt_akun[2];?>) have no (access rights to read) folder.<br/> 
  703. For more info about "Incoming" or "Shared with me", please visit <dfn>https://support.google.com/drive/answer/2375057?hl=en</dfn>. 
  704. </p> 
  705. <p> 
  706. Once the folder created, your folder will be listed in the "Incoming" or "Shared with me" area <dfn>https://drive.google.com/drive/shared-with-me</dfn>. 
  707. </p> 
  708. <p> 
  709. This plugin requires at least 1 folder to store your files. 
  710. </p> 
  711. <form name="gdwpm_form_gawe_folder" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>"> 
  712. <?php $gdwpm_gawe_folder_nonce = wp_create_nonce( "gdwpm_gawe_folder_nonce" ); ?> 
  713. <input type="hidden" name="gdwpm_gawe_folder_nonce" value="<?php echo $gdwpm_gawe_folder_nonce;?>"> 
  714. <p> 
  715. Folder Name: <input type="text" name="gdwpm_gawe_folder" value="" placeholder="Alphanumeric only"> <button id="simpen_gawe_folder"><?php _e('Create Folder') ?></button> 
  716. </p> 
  717. </form> 
  718. </div> 
  719. <?php } ?> 
  720. </div> 
  721. </div> 
  722. <?php if(!empty($foldercek)) { ?> 
  723. <h3>Galleries [Alpha: experimental]</h3> 
  724. <div> 
  725. <?php 
  726. $gdwpm_url_tab_albums = admin_url( 'admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=albums&gdwpm_tabulasi_albums_nonce=') . wp_create_nonce( "gdwpm_tabulasi_albums_nonce" ); 
  727. $gdwpm_url_tab_galleries = admin_url( 'admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=galleries&gdwpm_tabulasi_galleries_nonce=') . wp_create_nonce( "gdwpm_tabulasi_galleries_nonce" ); 
  728. ?> 
  729. <div id="gdwpm-albums" style="margin:0 -12px 0 -12px;"> 
  730. <ul> 
  731. <li><a href="<?php echo $gdwpm_url_tab_albums; ?>"><span style="float:left" class="ui-icon ui-icon-contact"></span> Albums</a></li> 
  732. <li><a href="<?php echo $gdwpm_url_tab_galleries; ?>"><span style="float:left" class="ui-icon ui-icon-image"></span> Galleries</a></li> 
  733. <li><a href="#gdwpm-albums-3"><span style="float:left" class="ui-icon ui-icon-cart"></span> Gallery Creator</a></li> 
  734. </ul> 
  735. <!-- <div id="gdwpm-albums-1"></div> --> 
  736. <!-- <div id="gdwpm-albums-2"></div> --> 
  737. <div id="gdwpm-albums-3"> 
  738. <p style="display: flex; align-items: center;">Select folder:  <?php echo str_replace('folder_pilian', 'folder_pilian_file_gal', $folderpil); ?>  <select id="pilihMaxResgal"> 
  739. <?php for($i=1;$i<=10;$i++) {$inum = $i * 10;?> 
  740. <option value="<?php echo $inum;?>"><?php echo $inum;?> items/page</option>  
  741. <?php } ?> 
  742. </select>  <button id="gdwpm_file_gallery" name="gdwpm_file_gallery"><?php _e('Get Files') ?></button>    
  743. <p>  
  744. <p> 
  745. <span class="sukses_gal">Please select folder and click Get Files, to show all files belongs to it. 
  746. </span> 
  747. </p> 
  748. <div style="display: none" id="gdwpm_loading_gbr_gal"> 
  749. <center><img src="<?php echo plugins_url( '/images/animation/gdwpm_loader_256.gif', __FILE__ );?>" /><br />Please wait...</center> 
  750. </div> 
  751. <div id="hasil_gal"></div> 
  752. <div id="vaginasi_gal" style="text-align:center;margin-top:25px;"></div> 
  753. <div style="display: none" id="gdwpm_masuk_gallery_teks"><p>Collect your images to create a new Gallery.</p> 
  754. <p><span style="display: none" id="gdwpm_add_to_gal_gbr"> 
  755. <img src="<?php echo plugins_url( '/images/animation/loading-bar-image.gif', __FILE__ );?>" /> 
  756. </span> 
  757. <button id="gdwpm_berkas_masuk_gallery" name="gdwpm_berkas_masuk_gallery">Add to Collector</button>     
  758.  
  759. <span id="gdwpm_info_masuk_gallery"></span> 
  760. </p> 
  761. </div> 
  762. <br/> 
  763. <div id="gallery_box" class="ui-widget-content ui-helper-clearfix ui-corner-all" style="padding:1em 1em 3em 1em;position:relative;"> 
  764. <div class="ui-corner-all ui-widget-header" style="margin-bottom:20px;padding:0.5em;text-align:center;">Collector</div> 
  765. <div id="gallery_holder"> 
  766. </div> 
  767. <span id="gallery_box_info" style="display:none;position:absolute;bottom:5px;right:15px;"> 
  768. <small style="opacity:0.5;"><i>*Drag to reorder.</i></small> 
  769. </span> 
  770. </div> 
  771. <br/> 
  772. <div id="gallery_input" style="display:none;"> 
  773. <p id="gal_intermezo" style="text-align:center;">Your Gallery is ready to be published..</p> 
  774. <span style="display: flex; align-items: center;"><label for="gallery_category" style="display:inline-block;width:110px;">Album </label>:  <select id="old_album"> 
  775. <?php 
  776. $terms = get_terms( 'gdwpm_album' ); 
  777. if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { 
  778. foreach ( $terms as $term ) { 
  779. ?>  
  780. <option value="<?php echo $term->name;?>"><?php echo $term->name;?></option>  
  781. <?php } 
  782. }else{ ?> 
  783. <option value="Uncategorized">Uncategorized</option>  
  784. <?php } ?>  
  785. </select>  or create a new album :  <input type="text" name="new_album" id="new_album" value="" size="16" placeholder="New Album Name" /> 
  786. </span><br/> 
  787. <label for="gallery_title" style="display:inline-block;width:110px;">Title </label>: <input type="text" name="gallery_title" id="gallery_title" value="" size="60" placeholder="Gallery Title" /> 
  788. <br/><br/> 
  789. <span style="display: flex; align-items: center;"> 
  790. <label for="gallery_style" style="display:inline-block;width:110px;">Images List </label>:  <select id="css_style"><option value="default">Default</option><option value="justified">Justified</option></select></span> 
  791. <br/>  
  792. <span id="css_style_opt" style="display: flex; align-items: center;"> 
  793. <label for="css_style_default" style="margin-left:140px;display:inline-block;width:150px;">Number of columns </label>:  <select id="css_style_default"> 
  794. <?php for($kenyot=3;$kenyot<10;$kenyot++) { ?> 
  795. <option value="<?php echo $kenyot;?>"><?php echo $kenyot;?></option><?php } ?></select> 
  796. </span> 
  797.  
  798. <span id="css_style_opt1"> 
  799. <span style="display: flex; align-items: center;"> 
  800. <label for="css_justified_margins" style="margin-left:140px;display:inline-block;width:100px;">margins</label>: <select id="css_justified_margins"><?php for($ciblek=1;$ciblek<11;$ciblek++) { ?> 
  801. <option value="<?php echo $ciblek;?>"><?php echo $ciblek;?> px</option><?php } ?></select> 
  802. </span><br/> 
  803. <span style="display: flex; align-items: center;"> 
  804. <label for="css_justified_row" style="margin-left:140px;display:inline-block;width:100px;">rowHeight</label>: <select id="css_justified_row"><?php for($jemek=5;$jemek<20;$jemek++) { ?> 
  805. <option value="<?php echo $jemek * 10;?>"><?php echo $jemek * 10;?> px</option><?php } ?> 
  806. </select> 
  807. </span><br/> 
  808. <span style="display: flex; align-items: center;"> 
  809. <label for="css_justified_last" style="margin-left:140px;display:inline-block;width:100px;">lastRow</label>: <select id="css_justified_last"><option value="justify">Justify</option><option value="nojustify">Nojustify</option><option value="hide">Hide</option></select> 
  810. </span> 
  811. </span> 
  812. <br/>  
  813. <span style="display: flex; align-items: center;"> 
  814. <label for="css_effect" style="display:inline-block;width:110px;">Effect </label>:  <select id="css_effect"><option value="default">Default</option><option value="blackwhite">Black & White</option><option value="lighthover">Light on Hover</option></select> 
  815. </span><br/> 
  816.  
  817. <span style="display: flex; align-items: center;"> 
  818. <label for="gallery_jquery" style="display:inline-block;width:110px;">Image Viewer </label>:  <select id="gallery_jquery"><option value="lightbox">Lightbox</option></select> 
  819. </span><br/><br/> 
  820. <input type="hidden" id="gallery_id_edit" value="" /> 
  821. <button id="gdwpm_new_gallery" class="gdwpm_bikin_gallery">Create Gallery</button> 
  822. <button id="gdwpm_edit_gallery" class="gdwpm_bikin_gallery" style="display:none;">Update Gallery</button> 
  823. <span style="margin-left:300px;" id="gdwpm_reset_gallery"><a href="#"><small>Reset / Cancel</small></a></span> 
  824. </div> 
  825. <div id="gdwpm_creating_128" style="display:none;text-align:center;"> 
  826. <img src="<?php echo plugins_url( '/images/animation/gdwpm_loader_128.gif', __FILE__ );?>"><br/>Please wait..</div> 
  827. <div id="gallery_input_info"> </div> 
  828. </div> 
  829. </div> 
  830. </div> 
  831. <?php } ?> 
  832. <?php } ?> 
  833. <h3>Settings</h3> 
  834. <div> 
  835. <?php 
  836. $gdwpm_tabulasi_themeset_nonce = wp_create_nonce( "gdwpm_tabulasi_themeset_nonce" ); 
  837. $gdwpm_url_tab_themeset = admin_url( 'admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=themeset&gdwpm_tabulasi_themeset_nonce=') . $gdwpm_tabulasi_themeset_nonce; 
  838. ?> 
  839. <div id="gdwpm-settingtabs" style="margin:0 -12px 0 -12px;"> 
  840. <ul> 
  841. <li><a href="#gdwpm-settingtabs-1"><span style="float:left" class="ui-icon ui-icon-key"></span> Google Drive API Key</a></li> 
  842. <li><a href="<?php echo $gdwpm_url_tab_themeset; ?>"><span style="float:left" class="ui-icon ui-icon-video"></span> Themes</a></li> 
  843. </ul> 
  844. <div id="gdwpm-settingtabs-1"> 
  845.  
  846. <table id="gdwpm_form_konci"> 
  847. <tr> 
  848. <td> 
  849. <form name="gdwpm_isi_akun" method="post" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI']); ?>"> 
  850. Google Email 
  851. </td> 
  852. <td>: </td> 
  853. <td> 
  854. <input type="text" name="gdwpm_imel" value="<?php echo $gdwpm_opt_akun[0];?>" title="Email Account of this Api Project. eg: yourname@gmail.com" size="25"> 
  855. </td> 
  856. </tr> 
  857. <tr> 
  858. <td> 
  859. Client ID 
  860. </td> 
  861. <td>: </td> 
  862. <td> 
  863. <input type="text" name="gdwpm_klaen_aidi" value="<?php echo $gdwpm_opt_akun[1];?>" title="eg: c529d2ab21e09caae12836337905f0761xxxxxxx" size="45"> 
  864. </td> 
  865. </tr> 
  866. <tr> 
  867. <td> 
  868. Service Account Name 
  869. </td> 
  870. <td>: </td> 
  871. <td> 
  872. <input type="text" name="gdwpm_nama_service" value="<?php echo $gdwpm_opt_akun[2];?>" title="eg: budi-123@wati-456789.iam.gserviceaccount.com" size="45"> 
  873. </td> 
  874. </tr> 
  875. <tr> 
  876. <td> 
  877. Private Key Url Path 
  878. </td> 
  879. <td>: </td> 
  880. <td> 
  881. <input type="text" name="gdwpm_kunci_rhs" value="<?php echo $gdwpm_opt_akun[3];?>" title="eg: http://yourdomain.com/path/to/123xxx-privatekey.p12" size="65"> 
  882. </td> 
  883. </tr> 
  884. </table> 
  885. <br /> 
  886.  
  887. <?php $gdwpm_akun_nonce = wp_create_nonce( "gdwpm_akun_nonce" ); ?> 
  888.  
  889. <input type="hidden" name="gdwpm_akun_nonce" value="<?php echo $gdwpm_akun_nonce;?>"> 
  890. <p style="margin-left:35px;"> 
  891. <button type="submit" id="simpen_gdwpm_akun"><?php _e('Save') ?></button> 
  892. </p>  
  893. </form> 
  894. </div> 
  895. </div> 
  896. </div> 
  897. <?php }else{$cek_kunci = 'false';} ?> 
  898. <h3>Documentation</h3> 
  899. <div> 
  900. <?php 
  901. $gdwpm_tabulasi_nonce = wp_create_nonce( "gdwpm_tabulasi_ajax" ); 
  902. $gdwpm_url_tab_dokapi = admin_url( 'admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=docapi&gdwpm_tabulasi_nonce=') . $gdwpm_tabulasi_nonce; 
  903. $gdwpm_url_tab_dokserv = admin_url( 'admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=docserv&gdwpm_tabulasi_nonce=') . $gdwpm_tabulasi_nonce; 
  904. ?> 
  905. <div id="doktabs" style="margin:0 -12px 0 -12px;"> 
  906. <ul> 
  907. <li><a href="#doktabs-1"><span style="float:left" class="ui-icon ui-icon-note"></span> Requirements</a></li> 
  908. <li><a href="<?php echo $gdwpm_url_tab_dokapi; ?>"><span style="float:left" class="ui-icon ui-icon-suitcase"></span> Google Drive API</a></li> 
  909. <li><a href="<?php echo $gdwpm_url_tab_dokserv; ?>"><span style="float:left" class="ui-icon ui-icon-person"></span> Service Account</a></li> 
  910. </ul> 
  911. <div id="doktabs-1"> 
  912. <h3>Minimum requirements</h3> 
  913. <p> 
  914. PHP <?php echo MINPHP_GDWPM;?> with cURL enabled. 
  915. </p> 
  916. <p> 
  917. <span style="float:left" class="ui-icon ui-icon-info"></span> Your PHP version is <b><?php echo phpversion();?></b> and cURL <?php if(function_exists('curl_version')) {$curlver = curl_version(); echo 'version is '.$curlver['version'];}else{echo 'was disabled';} ?>. 
  918. </p> 
  919. </div> 
  920. </div> 
  921. </div> 
  922. <h3>About</h3> 
  923. <div> 
  924. <p> 
  925. <?php echo NAMA_GDWPM;?> current installed version is <?php echo VERSI_GDWPM;?> 
  926. </p> 
  927. <p> 
  928. <?php echo NAMA_GDWPM;?> was created and developed by Moch Amir. <br />It is licensed as Free Software under GNU General Public License 2 (GPL 2). 
  929. You can find more information about <?php echo NAMA_GDWPM;?> on its page in the WordPress Plugin Directory. Please rate and review the plugin in the WordPress Plugin Directory. 
  930. </p> 
  931. <p> 
  932. If you have any question, there's support forum provided in its page too. Before asking for support, please carefully read the Frequently Asked Questions, where you will find answers to the most common questions, and search through the forums. 
  933. </p> 
  934. <p> 
  935. If you do not find an answer there, please open a new thread in the WordPress Support Forums. 
  936. </p> 
  937. <p style="margin-top:57px;"> 
  938. Special thanks to everyone for the donations, you are one of my reasons why this plugin is actively maintained and updated. 
  939. </p> 
  940. <p> 
  941. Thank You! 
  942. </p> 
  943. <small> 
  944. Credits: 
  945. <ul> 
  946. <li>Google Drive API & products are owned by Google inc.</li>  
  947. <li>Table Style credit to R. Christie (SmashingMagazine).</li>  
  948. <li>DriveServiceHelper Class credit to Lukasz Kujawa.</li>  
  949. <li>JQuery Upload credit to PLUpload by Moxiecode Systems AB.</li>  
  950. <li>JQuery User Interface by JQueryUI.</li>  
  951. <li>Alternative openssl sign function by Rochelle Alder.</li>  
  952. <li>Lightbox by Lokesh Dhakar.</li>  
  953. <li>Justified Gallery by Miro Mannino.</li>  
  954. </ul> 
  955. </small> 
  956. </div> 
  957. </div> 
  958. <div id="dialog-message" title="Warning" style="display: none;"> 
  959. <p> 
  960. <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span> 
  961. This plugin requires api key to authorize your drive. 
  962. </p> 
  963. <p> 
  964. Click the documentation tab for more info. 
  965. </p> 
  966. </div> 
  967. <div id="gdwpm_pringatan_versi_php" title="Warning" style="display: none;"> 
  968. <p> 
  969. <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span> 
  970. Sorry, You can't use this plugin with your current PHP version.<br>This plugin requires <b>PHP <?php echo MINPHP_GDWPM;?></b>.<br> 
  971. Your PHP version is <b><?php echo phpversion();?></b>. 
  972. </p> 
  973. <p> 
  974. Please upgrade your PHP to <?php echo MINPHP_GDWPM;?>. 
  975. </p> 
  976. </div> 
  977. <script> 
  978. function gantiBaris(sel, tableid) { 
  979. var jumlahBaris = sel.value; 
  980. jumBaris(jumlahBaris, tableid); 
  981. function remove_itemgal(e) { 
  982. e.parentNode.parentNode.removeChild(e.parentNode); 
  983. if (jQuery('#gallery_holder > div').length > 1) { 
  984. jQuery('#gallery_input').show(); 
  985. }else{ 
  986. jQuery('#gallery_input').hide(); 
  987. jQuery('#gallery_box_info').hide(); 
  988.  
  989. jQuery(function() { 
  990. jQuery( "#gdwpm_pringatan_versi_php" ).dialog({ 
  991. autoOpen: <?php echo $gdwpm_cek_php;?>,  
  992. modal: true,  
  993. width: 350,  
  994. resizable: false,  
  995. buttons: { 
  996. Ok: function() { 
  997. jQuery( this ).dialog( "close" ); 
  998. }); 
  999. jQuery( "#dialog-message" ).dialog({ 
  1000. autoOpen: <?php if(isset($errorkon)) {echo 'false';}else{echo $cek_kunci;}?>,  
  1001. modal: true,  
  1002. width: 350,  
  1003. resizable: false,  
  1004. buttons: { 
  1005. Ok: function() { 
  1006. jQuery( this ).dialog( "close" ); 
  1007. }); 
  1008.  
  1009. jQuery( "#gallery_holder" ).sortable() 
  1010. jQuery( "#gallery_holder" ).disableSelection() 
  1011. jQuery( "#golek_seko_folder, #gdwpm_file_dr_folder, #gdwpm_file_gallery" ) 
  1012. .button({ 
  1013. icons: { 
  1014. primary: "ui-icon-circle-arrow-s" 
  1015. }) 
  1016.  
  1017. jQuery( "#gdwpm_buang_folder" ) 
  1018. .button({ 
  1019. icons: { 
  1020. primary: "ui-icon-trash" 
  1021. }) 
  1022.  
  1023. jQuery( "#gdwpm_berkas_buang" ) 
  1024. .button({ 
  1025. icons: { 
  1026. primary: "ui-icon-trash" 
  1027. }) 
  1028.  
  1029. jQuery( "#gdwpm_tombol_info_folder_baru" ) 
  1030. .button({ 
  1031. icons: { 
  1032. primary: "ui-icon-refresh" 
  1033. }) 
  1034.  
  1035. jQuery( "#gdwpm_berkas_masuk_perpus" ) 
  1036. .button({ 
  1037. icons: { 
  1038. primary: "ui-icon-circle-plus" 
  1039. }) 
  1040.  
  1041. jQuery( "#gdwpm_berkas_masuk_gallery" ) 
  1042. .button({ 
  1043. icons: { 
  1044. primary: "ui-icon-cart" 
  1045. }) 
  1046.  
  1047. jQuery( ".gdwpm_bikin_gallery" ) 
  1048. .button({ 
  1049. icons: { 
  1050. primary: "ui-icon-image" 
  1051. }) 
  1052.  
  1053. jQuery( "#gdwpm_tombol_bk_folder" ) 
  1054. .button({ 
  1055. icons: { 
  1056. primary: "ui-icon-folder-open" 
  1057. }) 
  1058.  
  1059. jQuery( "#gdwpm_tombol_bersih" ) 
  1060. .button({ 
  1061. icons: { 
  1062. primary: "ui-icon-grip-dotted-horizontal" 
  1063. }) 
  1064.  
  1065. jQuery( "#gdwpm_tombol_upload" ) 
  1066. .button({ 
  1067. icons: { 
  1068. primary: "ui-icon-arrowthickstop-1-n" 
  1069. }) 
  1070.  
  1071. jQuery( "#simpen_gdwpm_akun" ) 
  1072. .button({ 
  1073. icons: { 
  1074. primary: "ui-icon-person" 
  1075. }) 
  1076.  
  1077. jQuery( "#simpen_gawe_folder" ) 
  1078. .button({ 
  1079. icons: { 
  1080. primary: "ui-icon-folder-collapsed" 
  1081. })  
  1082. jQuery( "#gdwpm_tombol_repair_folder" ) 
  1083. .button({ 
  1084. icons: { 
  1085. primary: "ui-icon-wrench" 
  1086. }) 
  1087. <?php if ( version_compare( get_bloginfo('version'), '4.0', '>' ) ) { ?>  
  1088. jQuery( "#pilihMaxRes" ) 
  1089. .selectmenu(); 
  1090. jQuery( "#pilihMaxResdel" ) 
  1091. .selectmenu(); 
  1092. jQuery( "#pilihMaxResgal" ) 
  1093. .selectmenu(); 
  1094.  
  1095. jQuery( "#folder_pilian" ) 
  1096. .selectmenu() 
  1097. .selectmenu( "menuWidget" ) 
  1098. .addClass( "overflowpil" ); 
  1099. jQuery( "#folder_pilian_aplod" ) 
  1100. .selectmenu() 
  1101. .selectmenu( "menuWidget" ) 
  1102. .addClass( "overflowapl" ); 
  1103. jQuery( "#buang_folder_pilian" ) 
  1104. .selectmenu() 
  1105. .selectmenu( "menuWidget" ) 
  1106. .addClass( "overflowbua" ); 
  1107. jQuery( "#repair_folder_pilian" ) 
  1108. .selectmenu() 
  1109. .selectmenu( "menuWidget" ) 
  1110. .addClass( "overflowrep" ); 
  1111. jQuery( "#folder_pilian_file_del" ) 
  1112. .selectmenu() 
  1113. .selectmenu( "menuWidget" ) 
  1114. .addClass( "overflowdel" ); 
  1115. jQuery( "#folder_pilian_file_gal" ) 
  1116. .selectmenu() 
  1117. .selectmenu( "menuWidget" ) 
  1118. .addClass( "overflowgal" ); 
  1119. jQuery( "#old_album, #css_effect, #css_style_default, #css_justified_margins, #css_justified_row, #css_justified_last, #gallery_jquery" ) 
  1120. .selectmenu() 
  1121. .selectmenu( "menuWidget" ) 
  1122. .addClass( "overflowolal" ); 
  1123. jQuery( "#css_style" ) 
  1124. .selectmenu({ change: function( event, ui ) {  
  1125. if(jQuery( this ).val() == 'default') { 
  1126. jQuery('#css_style_opt').show(); 
  1127. jQuery('#css_style_opt1').hide(); 
  1128. }else{ 
  1129. jQuery('#css_style_opt').hide(); 
  1130. jQuery('#css_style_opt1').show(); 
  1131. }}) 
  1132. .selectmenu( "menuWidget" ) 
  1133. .addClass( "overflowolal" ); 
  1134. <?php } ?> 
  1135. jQuery('input').addClass("ui-corner-all"); 
  1136. }); 
  1137. </script> 
  1138. <?php 
  1139.