Changeset 1096264
- Timestamp:
- 02/22/2015 06:22:49 AM (11 years ago)
- Location:
- google-drive-wp-media/trunk
- Files:
-
- 2 edited
-
google-drive-wp-media.php (modified) (8 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
google-drive-wp-media/trunk/google-drive-wp-media.php
r1094516 r1096264 6 6 Author: Moch Amir 7 7 Author URI: http://www.mochamir.com/ 8 Version: 2.2.98 Version: 3.0 9 9 License: GNU General Public License v2.0 or later 10 10 License URI: http://www.opensource.org/licenses/gpl-license.php … … 33 33 define( 'ALMT_GDWPM', 'google-drive-wp-media' ); 34 34 define( 'MINPHP_GDWPM', '5.3.0' ); 35 define( 'VERSI_GDWPM', ' 2.2.9' );35 define( 'VERSI_GDWPM', '3.0' ); 36 36 define( 'MY_TEXTDOMAIN', 'gdwpm' ); 37 37 … … 235 235 this.window.on('select', function() { 236 236 var first = self.window.state().get('selection').first().toJSON(); 237 if (first.url.indexOf(".google") > -1 || first.url.indexOf("gdwpm_images") > -1){237 if (first.url.indexOf(".google") > -1){ 238 238 var gdwpm_video_cekbok = '<?php echo $gdwpm_ukuran_preview[2];?>'; 239 239 if (first.mime.indexOf("video/") > -1 && gdwpm_video_cekbok == 'checked'){ … … 242 242 wp.media.editor.insert('[gdwpm id="' + first.filename + '" w="<?php echo $gdwpm_ukuran_preview[0];?>" h="<?php echo $gdwpm_ukuran_preview[1];?>"]'); 243 243 } 244 } 245 if (first.url.indexOf("gdwpm_images") > -1){ 246 var gdfileid = first.filename; 247 if( gdfileid.indexOf(".") > -1 ){ 248 var gdfileid = gdfileid.substr(0, gdfileid.lastIndexOf(".")); 249 } 250 wp.media.editor.insert('[gdwpm id="' + gdfileid + '" w="<?php echo $gdwpm_ukuran_preview[0];?>" h="<?php echo $gdwpm_ukuran_preview[1];?>"]'); 244 251 } 245 252 }); … … 371 378 372 379 } else { 373 if (!EMPTY($_POST['gdwpm_imel']) && !EMPTY($_POST['gdwpm_klaen_aidi']) && !EMPTY($_POST['gdwpm_nama_service']) && !EMPTY($_POST['gdwpm_kunci_rhs'])) 380 $gdwpm_opt_imel = sanitize_email($_POST['gdwpm_imel']); 381 $gdwpm_opt_klaen_aidi = sanitize_text_field($_POST['gdwpm_klaen_aidi']); 382 $gdwpm_opt_nama_service = sanitize_email($_POST['gdwpm_nama_service']); 383 $gdwpm_opt_kunci_rhs = esc_url($_POST['gdwpm_kunci_rhs']); 384 385 $gdwpm_opt_akun = array($gdwpm_opt_imel, $gdwpm_opt_klaen_aidi, $gdwpm_opt_nama_service, $gdwpm_opt_kunci_rhs); 386 387 if (!EMPTY($gdwpm_opt_imel) && !EMPTY($gdwpm_opt_klaen_aidi) && !EMPTY($gdwpm_opt_nama_service) && !EMPTY($gdwpm_opt_kunci_rhs)) 374 388 { 375 $gdwpm_opt_imel = sanitize_email($_POST['gdwpm_imel']); 376 $gdwpm_opt_klaen_aidi = sanitize_text_field($_POST['gdwpm_klaen_aidi']); 377 $gdwpm_opt_nama_service = sanitize_email($_POST['gdwpm_nama_service']); 378 $gdwpm_opt_kunci_rhs = esc_url($_POST['gdwpm_kunci_rhs']); 379 380 $gdwpm_opt = array($gdwpm_opt_imel, $gdwpm_opt_klaen_aidi, $gdwpm_opt_nama_service, $gdwpm_opt_kunci_rhs); 381 update_option('gdwpm_akun_opt', $gdwpm_opt); 382 update_option('gdwpm_img_thumbs', array('', '', '150', '150', 'false')); 383 echo '<div class="updated"><p>Great! API settings successfully saved.</p></div>'; 389 // test akun 390 if(!isset($gdwpm_service)){ 391 $gdwpm_service = new GDWPMBantuan( $gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3] ); 392 } 393 try { 394 $gdwpm_apiConfig['use_objects'] = true; 395 $ebot = $gdwpm_service->getAbout(); 396 update_option('gdwpm_akun_opt', $gdwpm_opt_akun); 397 update_option('gdwpm_img_thumbs', array('', '', '150', '150', 'false')); 398 echo '<div class="updated"><p>API settings successfully saved.</p></div>'; 399 } catch (Exception $errorkon) { 400 $cek_kunci = 'true'; 401 echo '<div class="error"><p>An error occurred: ' . wp_strip_all_tags($errorkon->getMessage()) . '. Your settings could not be saved.</p></div>'; 402 } 384 403 }else{ 385 echo '<div class="error"><p>All fields are required. </p></div>';386 } 387 } 388 } 389 $gdwpm_opt_akun = get_option('gdwpm_akun_opt');// imel, client id, gdwpm_service akun, private key404 echo '<div class="error"><p>All fields are required. Your settings could not be saved.</p></div>'; 405 } 406 } 407 } 408 if(!isset($gdwpm_opt_akun)){$gdwpm_opt_akun = get_option('gdwpm_akun_opt');} // imel, client id, gdwpm_service akun, private key 390 409 if($gdwpm_opt_akun){ 391 $cek_kunci = 'false'; 392 //$gdwpm_apiConfig['use_objects'] = true; 393 if(!$gdwpm_service){ $gdwpm_service = new GDWPMBantuan( $gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3] ); } 410 if (!EMPTY($gdwpm_opt_akun[0]) && !EMPTY($gdwpm_opt_akun[1]) && !EMPTY($gdwpm_opt_akun[2]) && !EMPTY($gdwpm_opt_akun[3])) 411 { 412 $cek_kunci = 'false'; 413 //$gdwpm_apiConfig['use_objects'] = true; 414 if(!isset($gdwpm_service)){ 415 $gdwpm_service = new GDWPMBantuan( $gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3] ); 416 } 417 } 394 418 } 395 419 … … 656 680 $gdwpm_apiConfig['use_objects'] = true; 657 681 658 if($gdwpm_opt_akun){ 659 $parameters = array('q' => "mimeType = 'application/vnd.google-apps.folder'", 'maxResults' => 50); 660 $files = $gdwpm_service->files->listFiles($parameters); 661 $folderpil = '<select id="folder_pilian" name="folder_pilian">'; 662 $foldercek = array(); 663 foreach( $files->getItems() as $item ) 664 {//description, title 665 if('gdwpm-thumbnails' == $item->getTitle()){$selek = ' disabled';}else{$selek = '';} 666 $folderpil .= '<option value="'.$item->getId().'"'.$selek.'>'.$item->getTitle().'</option>'; 667 $foldercek[] = $item->getTitle(); 668 } 669 $folderpil .= '</select>'; 670 $foldercek = array_filter($foldercek); 671 672 if (empty($foldercek)) { 673 $folderpil = ''; 674 } 682 if($gdwpm_opt_akun && !isset($errorkon)){ 683 if (!EMPTY($gdwpm_opt_akun[0]) && !EMPTY($gdwpm_opt_akun[1]) && !EMPTY($gdwpm_opt_akun[2]) && !EMPTY($gdwpm_opt_akun[3])) 684 { 685 // cek dolo sbagai awal dr smuanya :p 686 try { 687 $parameters = array('q' => "mimeType = 'application/vnd.google-apps.folder'", 'maxResults' => 50); 688 $files = $gdwpm_service->files->listFiles($parameters); 689 $folderpil = '<select id="folder_pilian" name="folder_pilian">'; 690 $foldercek = array(); 691 foreach( $files->getItems() as $item ) 692 {//description, title 693 if('gdwpm-thumbnails' == $item->getTitle()){$selek = ' disabled';}else{$selek = '';} 694 $folderpil .= '<option value="'.$item->getId().'"'.$selek.'>'.$item->getTitle().'</option>'; 695 $foldercek[] = $item->getTitle(); 696 } 697 $folderpil .= '</select>'; 698 $foldercek = array_filter($foldercek); 699 700 if (empty($foldercek)) { 701 $folderpil = ''; 702 } 703 } catch (Exception $e) { 704 $cek_kunci = 'true'; 705 echo '<div class="error"><p>An error occurred: ' . wp_strip_all_tags($e->getMessage()) . '</p></div>'; 706 } 707 } 708 }else{ 709 $cek_kunci = 'true'; 675 710 } 676 711 ?> … … 738 773 * Replace <code><strong>GOOGLE-DRIVE-FILE-ID</strong></code> with your file ID. 739 774 <?php 740 $ebot = $gdwpm_service->getAbout();775 if(!isset($ebot)){$ebot = $gdwpm_service->getAbout();} 741 776 echo '<br /><br />Storage Usage<br />Total quota: '.size_format($ebot->getQuotaBytesTotal(), 2).'<br /> 742 777 Quota Used: '.size_format($ebot->getQuotaBytesUsed(), 2).'<br /> … … 1203 1238 }); 1204 1239 jQuery( "#dialog-message" ).dialog({ 1205 autoOpen: <?php echo $cek_kunci;?>,1240 autoOpen: <?php if(isset($errorkon)){echo 'false';}else{echo $cek_kunci;}?>, 1206 1241 modal: true, 1207 1242 width: 350, -
google-drive-wp-media/trunk/readme.txt
r1094516 r1096264 5 5 Requires at least: 3.5 6 6 Tested up to: 4.1 7 Stable tag: 2.2.97 Stable tag: 3.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 81 81 == Changelog == 82 82 83 = 3.0 = 84 85 * Bugs fixed 86 83 87 = 2.2.9 = 84 88
Note: See TracChangeset
for help on using the changeset viewer.