Ejemplo n.º 1
0
function gdwpm_halaman_utama()
{
    global $cek_kunci, $gdwpm_opt_akun, $gdwpm_service, $gdwpm_apiConfig;
    require_once 'gdwpm-api/Google_Client.php';
    require_once 'gdwpm-api/contrib/Google_DriveService.php';
    $cek_kunci = 'true';
    // kosong
    if (isset($_REQUEST['gdwpm_opsi_kategori_nonce'])) {
        require_once ABSPATH . 'wp-includes/pluggable.php';
        if (!wp_verify_nonce($_REQUEST['gdwpm_opsi_kategori_nonce'], 'gdwpm_override_dir')) {
            wp_die('<div class="error"><p>Security check not verified!</p></div>');
        } else {
            if ($_POST['gdwpm_cekbok_opsi_kategori'] == 1) {
                update_option('gdwpm_opsi_kategori_dr_folder', 'checked');
                echo '<div class="updated"><p>GDWPM Categories has been enabled.</p></div>';
            } else {
                update_option('gdwpm_opsi_kategori_dr_folder', '');
                echo '<div class="updated"><p>GDWPM Categories has been disabled.</p></div>';
            }
        }
    }
    if (isset($_REQUEST['gdwpm_opsi_chunkpl_nonce'])) {
        require_once ABSPATH . 'wp-includes/pluggable.php';
        if (!wp_verify_nonce($_REQUEST['gdwpm_opsi_chunkpl_nonce'], 'gdwpm_chunkpl_nonce')) {
            wp_die('<div class="error"><p>Security check not verified!</p></div>');
        } else {
            $input_cek = true;
            $input_chunkarr = array('gdwpm_drive_chunk_size', 'gdwpm_drive_chunk_retries', 'gdwpm_local_chunk_size', 'gdwpm_local_chunk_retries');
            foreach ($input_chunkarr as $val) {
                if (!ctype_digit($_POST[$val])) {
                    $input_cek = false;
                    break;
                }
            }
            if ($input_cek) {
                if (isset($_POST['gdwpm_cekbok_opsi_chunkpl'])) {
                    $ceket = 'checked';
                } else {
                    $ceket = '';
                }
                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'])));
                echo '<div class="updated"><p>Chunking Settings saved.</p></div>';
            } else {
                echo '<div class="error"><p>Chunking Settings cannot be saved. You must provide Numeric value.</p></div>';
            }
        }
    }
    if (isset($_POST['gdwpm_akun_nonce'])) {
        $nonce = $_POST['gdwpm_akun_nonce'];
        if (!wp_verify_nonce($nonce, 'gdwpm_akun_nonce')) {
            die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
        } else {
            $gdwpm_opt_imel = sanitize_email($_POST['gdwpm_imel']);
            $gdwpm_opt_klaen_aidi = sanitize_text_field($_POST['gdwpm_klaen_aidi']);
            $gdwpm_opt_nama_service = sanitize_email($_POST['gdwpm_nama_service']);
            $gdwpm_opt_kunci_rhs = esc_url($_POST['gdwpm_kunci_rhs']);
            $gdwpm_opt_akun = array($gdwpm_opt_imel, $gdwpm_opt_klaen_aidi, $gdwpm_opt_nama_service, $gdwpm_opt_kunci_rhs);
            if (!empty($gdwpm_opt_imel) && !empty($gdwpm_opt_klaen_aidi) && !empty($gdwpm_opt_nama_service) && !empty($gdwpm_opt_kunci_rhs)) {
                // test akun
                if (!isset($gdwpm_service)) {
                    $gdwpm_service = new GDWPMBantuan($gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3]);
                }
                try {
                    $gdwpm_apiConfig['use_objects'] = true;
                    $ebot = $gdwpm_service->getAbout();
                    update_option('gdwpm_akun_opt', $gdwpm_opt_akun);
                    update_option('gdwpm_img_thumbs', array('', '', '150', '150', 'false'));
                    echo '<div class="updated"><p>API settings successfully saved.</p></div>';
                } catch (Exception $errorkon) {
                    $cek_kunci = 'true';
                    echo '<div class="error"><p>An error occurred: ' . wp_strip_all_tags($errorkon->getMessage()) . '. Your settings could not be saved.</p></div>';
                }
            } else {
                echo '<div class="error"><p>All fields are required. Your settings could not be saved.</p></div>';
            }
        }
    }
    if (!isset($gdwpm_opt_akun)) {
        $gdwpm_opt_akun = get_option('gdwpm_akun_opt');
    }
    // imel, client id, gdwpm_service akun, private key
    if ($gdwpm_opt_akun) {
        if (!empty($gdwpm_opt_akun[0]) && !empty($gdwpm_opt_akun[1]) && !empty($gdwpm_opt_akun[2]) && !empty($gdwpm_opt_akun[3])) {
            $cek_kunci = 'false';
            //$gdwpm_apiConfig['use_objects'] = true;
            if (!isset($gdwpm_service)) {
                $gdwpm_service = new GDWPMBantuan($gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3]);
            }
        }
    }
    if (isset($_POST['gdwpm_opsi_thumbs_nonce'])) {
        require_once ABSPATH . 'wp-includes/pluggable.php';
        if (!wp_verify_nonce($_POST['gdwpm_opsi_thumbs_nonce'], 'gdwpm_thumbs_nonce')) {
            wp_die('<div class="error"><p>Security check not verified!</p></div>');
        } else {
            if (ctype_digit($_POST['gdwpm_thumbs_width']) && ctype_digit($_POST['gdwpm_thumbs_height'])) {
                if (isset($_POST['gdwpm_cekbok_opsi_thumbs'])) {
                    $ceket = 'checked';
                } else {
                    $ceket = '';
                }
                if ($_POST['gdwpm_thumbs_crop'] == 'true') {
                    $gdwpm_thumbs_crop = 'true';
                } else {
                    $gdwpm_thumbs_crop = 'false';
                }
                $gdwpm_opsi_thumbs = get_option('gdwpm_img_thumbs');
                if (is_array($gdwpm_opsi_thumbs) && !empty($gdwpm_opsi_thumbs[1])) {
                    update_option('gdwpm_img_thumbs', array($ceket, $gdwpm_opsi_thumbs[1], $_POST['gdwpm_thumbs_width'], $_POST['gdwpm_thumbs_height'], $gdwpm_thumbs_crop));
                    echo '<div class="updated"><p>Thumbnail settings successfully saved.</p></div>';
                } else {
                    $folderId_thumb = $gdwpm_service->getFolderIdByName('gdwpm-thumbnails');
                    if (!$folderId_thumb) {
                        $folderId_thumb = $gdwpm_service->createFolder('gdwpm-thumbnails');
                        if ($folderId_thumb) {
                            $gdwpm_service->setPermissions($folderId_thumb, $gdwpm_opt_akun[0]);
                        } else {
                            $folderId_thumb = '';
                        }
                    }
                    update_option('gdwpm_img_thumbs', array($ceket, $folderId_thumb, $_POST['gdwpm_thumbs_width'], $_POST['gdwpm_thumbs_height'], $gdwpm_thumbs_crop));
                    echo '<div class="updated"><p>Thumbnail settings successfully saved.</p></div>';
                }
            } else {
                echo '<div class="error"><p>Thumbnail settings error, only numeric can be accepted.</p></div>';
            }
        }
    }
    if (isset($_POST['repair_folder_pilian'])) {
        if (isset($_POST['gdwpm_folder_tools_nonce'])) {
            $nonce = $_POST['gdwpm_folder_tools_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_folder_tools_nonce')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
            } else {
                $folderId = $_POST['repair_folder_pilian'];
                $gdwpm_folder_permisi = $gdwpm_service->setPermissions($folderId, $gdwpm_opt_akun[0]);
                if ($gdwpm_folder_permisi) {
                    echo '<div class="updated"><p>Folder <strong>' . $folderId . '</strong> permissions changed.</p></div>';
                } else {
                    echo '<div class="error"><p>Folder ' . $folderId . ' permissions fail to change.</p></div>';
                }
            }
        } else {
            wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
        }
    }
    if (isset($_POST['buang_folder_pilian'])) {
        if (isset($_POST['gdwpm_folder_tools_nonce'])) {
            $nonce = $_POST['gdwpm_folder_tools_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_folder_tools_nonce')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
            } else {
                $gdwpm_nama_folder = $gdwpm_service->getNameFromId($_POST['buang_folder_pilian']);
                $gdwpm_tong_sampah = $gdwpm_service->buangFile($_POST['buang_folder_pilian']);
                if ($gdwpm_tong_sampah) {
                    echo '<div class="updated"><p>Folder <strong>' . $_POST['buang_folder_pilian'] . ' ' . $gdwpm_nama_folder . '</strong> successfully deleted.</p></div>';
                    sleep(3);
                } else {
                    echo '<div class="error"><p>' . $_POST['buang_folder_pilian'] . ' ' . $gdwpm_nama_folder . ' fail to delete.</p></div>';
                }
            }
        } else {
            wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
        }
    }
    if (isset($_POST['gdwpm_buang_berkas_terpilih'])) {
        if (isset($_POST['gdwpm_folder_tools_nonce'])) {
            $nonce = $_POST['gdwpm_folder_tools_nonce'];
            if (!wp_verify_nonce($nonce, 'gdwpm_folder_tools_nonce')) {
                wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
            } else {
                $gdwpm_info_files = '';
                if (is_array($_POST['gdwpm_buang_berkas_terpilih'])) {
                    foreach ($_POST['gdwpm_buang_berkas_terpilih'] as $value) {
                        //$gdwpm_berkas_terpilih_array = explode(' | ', $value); // mime, name, id, desc, folder, pptis
                        $gdwpm_berkas_terpilih_array = json_decode(base64_decode($value), true);
                        $gdwpm_tong_sampah = $gdwpm_service->buangFile($gdwpm_berkas_terpilih_array[2]);
                        if ($gdwpm_tong_sampah) {
                            $gdwpm_info_files .= '<strong>' . $gdwpm_berkas_terpilih_array[1] . '</strong> deleted, ';
                        } else {
                            $gdwpm_info_files .= '<strong>' . $gdwpm_berkas_terpilih_array[1] . '</strong> failed, ';
                        }
                        //sleep(0.5);
                    }
                } else {
                    //$gdwpm_berkas_terpilih_array = explode(' | ', $_POST['gdwpm_buang_berkas_terpilih']); // mime, name, id, desc, folder, pptis
                    $gdwpm_berkas_terpilih_array = json_decode(base64_decode($_POST['gdwpm_buang_berkas_terpilih']), true);
                    $gdwpm_tong_sampah = $gdwpm_service->buangFile($gdwpm_berkas_terpilih_array[2]);
                    if ($gdwpm_tong_sampah) {
                        $gdwpm_info_files = '<strong>' . $gdwpm_berkas_terpilih_array[1] . '</strong> deleted, ';
                    } else {
                        $gdwpm_info_files = '<strong>' . $gdwpm_berkas_terpilih_array[1] . '</strong> failed, ';
                    }
                }
                echo '<div class="updated"><p>' . $gdwpm_info_files . '.. Done!.</p></div>';
                sleep(3);
            }
        } else {
            wp_die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
        }
    }
    if (isset($_POST['gdwpm_gawe_folder_nonce'])) {
        require_once ABSPATH . 'wp-includes/pluggable.php';
        $nonce = $_POST['gdwpm_gawe_folder_nonce'];
        if (!wp_verify_nonce($nonce, 'gdwpm_gawe_folder_nonce')) {
            die('<div class="error"><p>Oops.. security check is not ok!</p></div>');
        } else {
            if (!empty($_POST['gdwpm_gawe_folder'])) {
                $gawe_folder = preg_replace("/[^a-zA-Z0-9]+/", " ", $_POST['gdwpm_gawe_folder']);
                $gawe_folder = sanitize_text_field($gawe_folder);
                $folderId = $gdwpm_service->createFolder($gawe_folder);
                $gdwpm_folder_permisi = $gdwpm_service->setPermissions($folderId, $gdwpm_opt_akun[0]);
                if ($gdwpm_folder_permisi) {
                    echo '<div class="updated"><p>Great! Folder name <strong>' . $gawe_folder . '</strong> successfully created.</p></div>';
                } else {
                    echo '<div class="error"><p>Folder ' . $gawe_folder . ' created but permission fail to change.</p></div>';
                }
            } else {
                echo '<div class="error"><p>Folder name cannot be empty!</p></div>';
            }
        }
    }
    ?>
<script>
jQuery(function() {
    var icons = {
		header: "ui-icon-triangle-1-e",
		activeHeader: "ui-icon-lightbulb"
    };
    jQuery( "#accordion" ).accordion({
		heightStyle: "content",
		icons: icons
    });
	  
	jQuery("[title]").tooltip({ 
		track: true,
		show: { effect: 'slideDown' },
		open: function (event, ui) { setTimeout(function () {
				jQuery(ui.tooltip).hide('explode');
			}, 3000); }
	});
     
	jQuery( "#tabs" ).tabs({
		beforeLoad: function( event, ui ) {
			ui.jqXHR.error(function() {
				ui.panel.html(
				"Opening Options tab, please wait.. <p>If this take too long, there's something wrong with your internet connection.<br/>Well, don't be bad.. it's just a guess. :)</p>" );
			});
		}
    });
  
	jQuery( "#doktabs" ).tabs({
		beforeLoad: function( event, ui ) {
			ui.jqXHR.error(function() {
				ui.panel.html(
				"Opening plugin documentation tab, please wait..<p>If this take too long, there's something wrong with your internet connection.<br/>Well, don't be bad.. it's just a guess. :)</p>" );
			});
		}
    });
	
	jQuery( "#gdwpm-settingtabs" ).tabs({
		beforeLoad: function( event, ui ) {
			ui.jqXHR.error(function() {
				ui.panel.html(
				"Opening Themes Setting tab, please wait..<p>If this take too long, there's something wrong with your internet connection.:)</p>" );
			});
		}	
    });
	
	jQuery( "#gdwpm-albums" ).tabs({
		beforeLoad: function( event, ui ) {
			ui.jqXHR.error(function() {
				ui.panel.html(
				"Opening Albums tab, please wait..<p>If this take too long, there's something wrong with your internet connection.</p>" );
			});
		}	
    });
});
</script>
<style type="text/css">
a.tabeksen:link {
    color: #3399FF	;
}
a.tabeksen:hover {
    color: #FF0000;
}
#box-table-a
{
	font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
	font-size: 12px;
	width:100%;
	text-align: left;
	border-collapse: collapse;
}
#box-table-a th
{
	font-size: 13px;
	font-weight: normal;
	padding: 8px;
	background: #B6F0F6;
	border-top: 4px solid #DAF8FB;
	border-bottom: 1px solid #fff;
	color: #039;
}
#box-table-a td
{
	padding: 8px;
	background: #EAFAFC; 
	border-bottom: 1px solid #fff;
	color: #669;
	border-top: 1px solid transparent;
}
#box-table-a tr:hover td
{
	background: #FFFFCF;
	color: #339;
}

div.halpager {
    text-align: center;
    margin: 1em 0;
}

div.halpager span {
    display: inline-block;
    width: 1.8em;
    height: 1.8em;
    line-height: 1.8;
    text-align: center;
    cursor: pointer;
    background: #EAFAFC;
    color: #039;
    margin-right: 0.5em;
}

div.halpager span.active {
    background: #B6F0F6;
}
#pilihMaxRes { width: 110px; }
#pilihMaxResdel { width: 140px; }
#pilihMaxResgal { width: 140px; }
#folder_pilian{ width: 200px; }
  .overflowpil { max-height: 370px; }
#folder_pilian_aplod { width: 190px; }
  .overflowapl { max-height: 360px; }
#buang_folder_pilian { width: 230px; }
  .overflowbua { max-height: 300px; }
#repair_folder_pilian { width: 230px; }
  .overflowrep { max-height: 300px; }
#folder_pilian_file_del { width: 220px; }
  .overflowdel { max-height: 360px; }
#folder_pilian_file_gal { width: 220px; }
  .overflowgal { max-height: 370px; }
#old_album { width: 180px; }
  .overflowolal { max-height: 370px; }
#css_style, #css_style_default, #css_justified_margins, #css_justified_row, #css_justified_last { width: 120px; }
#css_effect, #gallery_jquery { width: 140px; } 
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; }
#itemgal { margin: 5px 10px 5px 0; padding: 5px; float: left; width: 160px; text-align: center; }
#itemgal img { height: 150px; width="auto"; }
#itemgal input { margin-top: 5px; }
</style>
<?php 
    $gdwpm_apiConfig['use_objects'] = true;
    if ($gdwpm_opt_akun && !isset($errorkon)) {
        if (!empty($gdwpm_opt_akun[0]) && !empty($gdwpm_opt_akun[1]) && !empty($gdwpm_opt_akun[2]) && !empty($gdwpm_opt_akun[3])) {
            // cek dolo sbagai awal dr smuanya :p
            try {
                $parameters = array('q' => "mimeType = 'application/vnd.google-apps.folder'", 'maxResults' => 50);
                $files = $gdwpm_service->files->listFiles($parameters);
                $folderpil = '<select id="folder_pilian" name="folder_pilian">';
                $foldercek = array();
                foreach ($files->getItems() as $item) {
                    //description, title
                    if ('gdwpm-thumbnails' == $item->getTitle()) {
                        $selek = ' disabled';
                    } else {
                        $selek = '';
                    }
                    $folderpil .= '<option value="' . $item->getId() . '"' . $selek . '>' . $item->getTitle() . '</option>';
                    $foldercek[] = $item->getTitle();
                }
                $folderpil .= '</select>';
                $foldercek = array_filter($foldercek);
                if (empty($foldercek)) {
                    $folderpil = '';
                }
            } catch (Exception $e) {
                $cek_kunci = 'true';
                echo '<div class="error"><p>An error occurred: ' . wp_strip_all_tags($e->getMessage()) . '</p></div>';
            }
        }
    } else {
        $cek_kunci = 'true';
    }
    ?>
<div id="accordion" style="margin:10px 10px 5px 10px;">
<?php 
    //cek versi php
    $gdwpm_cek_php = 'true';
    if (version_compare(PHP_VERSION, MINPHP_GDWPM) >= 0) {
        $gdwpm_cek_php = 'false';
        global $cek_kunci;
        if ($cek_kunci == 'false') {
            ?>
		<h3>My Google Drive</h3>
	<div>
		<?php 
            $gdwpm_tab_opsi_nonce = wp_create_nonce("gdwpm_tab_opsi_key");
            $gdwpm_url_tab_opsi = admin_url('admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=opsyen&gdwpm_tab_opsi_nonce=') . $gdwpm_tab_opsi_nonce;
            $gdwpm_url_tab_info = admin_url('admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=infosyen&gdwpm_tab_info_nonce=') . $gdwpm_tab_opsi_nonce;
            ?>
		<div id="tabs" style="margin:0 -12px 0 -12px;">
		<ul>
 <?php 
            if (!empty($foldercek)) {
                ?>
			<li><a href="#tabs-1"><span style="float:left" class="ui-icon ui-icon-script"></span>&nbsp;File & Folder List</a></li>
			<li><a href="#tabs-2"><span style="float:left" class="ui-icon ui-icon-star"></span>&nbsp;Upload</a></li>
			<li><a href="<?php 
                echo $gdwpm_url_tab_opsi;
                ?>
"><span style="float:left" class="ui-icon ui-icon-clipboard"></span>&nbsp;Options</a></li>
			<li><a href="<?php 
                echo $gdwpm_url_tab_info;
                ?>
"><span style="float:left" class="ui-icon ui-icon-heart"></span>&nbsp;Account Information</a></li>
			<li><a href="#tabs-5"><span style="float:left" class="ui-icon ui-icon-gear"></span>&nbsp;Tools</a></li>
<?php 
            } else {
                ?>
			<li><a href="#tabs-6"><span style="float:left" class="ui-icon ui-icon-folder-collapsed"></span>&nbsp;Create Folder</a></li>
<?php 
            }
            ?>
		</ul>
 <?php 
            if (!empty($foldercek)) {
                ?>
			<div id="tabs-1" class="ui-helper-clearfix">
				<div id="tombol-donat" class="ui-widget-content ui-corner-all" style="width:190px; float:right; padding:1em;">	
					<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">
					<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.
					</p>
				</div>
				<p style="display: flex; align-items: center;">Select folder: &nbsp;<?php 
                echo str_replace(' disabled', '', $folderpil);
                ?>
&nbsp; <select id="pilihMaxRes">
				<?php 
                for ($i = 1; $i <= 10; $i++) {
                    $inum = $i * 10;
                    ?>
				<option value="<?php 
                    echo $inum;
                    ?>
"><?php 
                    echo $inum;
                    ?>
 items/page</option>				
				<?php 
                }
                ?>
				</select>&nbsp; <button id="golek_seko_folder" name="golek_seko_folder"><?php 
                _e('Get Files');
                ?>
</button> &nbsp;&nbsp;
					<span id="gdwpm_info_folder_baru" style="display:none;">
						There's a new folder.
						<a href=""><button id="gdwpm_tombol_info_folder_baru" name="gdwpm_tombol_info_folder_baru"><?php 
                _e('Reload Now');
                ?>
</button></a>
					</span>
				<?php 
                add_thickbox();
                $gdwpm_ukuran_preview = get_option('gdwpm_ukuran_preview');
                ?>
				<p>
					<span class="sukses">Please select folder and click Get Files, to show all files belongs to it.<br /><br />
						<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/>
						Shortcode: <code>[gdwpm id="<strong>GOOGLE-DRIVE-FILE-ID</strong>"]</code>
						<br />
						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>
						<br />
						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>
						<br/><?php 
                //$gdwpm_opsi_thumbs = get_option('gdwpm_img_thumbs');
                //print_r($gdwpm_opsi_thumbs);
                ?>
						Link URL: https://docs.google.com/uc?id=<code><strong>GOOGLE-DRIVE-FILE-ID</strong></code>&export=view <br/>
						or: https://www.googledrive.com/host/<code><strong>GOOGLE-DRIVE-FILE-ID</strong></code>
						<br />
						Preview: https://docs.google.com/file/d/<code><strong>GOOGLE-DRIVE-FILE-ID</strong></code>/preview
						<br/><small>
						* Replace <code><strong>GOOGLE-DRIVE-FILE-ID</strong></code> with your file ID. 
						<?php 
                if (!isset($ebot)) {
                    $ebot = $gdwpm_service->getAbout();
                }
                echo '<br /><br />Total quota: ' . size_format($ebot->getQuotaBytesTotal(), 2) . '<br />
							Quota Used: ' . size_format($ebot->getQuotaBytesUsed(), 2) . '</small>';
                ?>
					</span>
				</p>	
				<div style="display: none" id="gdwpm_loading_gbr">
				  <center><img src="<?php 
                echo plugins_url('/images/animation/gdwpm_loader_256.gif', __FILE__);
                ?>
" /><br />Please wait...</center>
				</div>
				<div id="hasil"></div>
				<div id="vaginasi" style="text-align:center;margin-top:25px;"></div>
				<div style="display: none" id="gdwpm_masuk_perpus_teks"><p>Pick a file to include it in the Media Library.</p>
					<p>
						<button id="gdwpm_berkas_masuk_perpus" name="gdwpm_berkas_masuk_perpus">Add to Media Library</button>&nbsp;&nbsp;&nbsp; 
						<span style="display: none" id="gdwpm_add_to_media_gbr">
							<img src="<?php 
                echo plugins_url('/images/animation/loading-bar-image.gif', __FILE__);
                ?>
" />
						</span>
						<span id="gdwpm_info_masuk_perpus"></span>
					</p>
				</div>
				<div style="display: none" id="gdwpm_info_folder_thumbs">
					<p>These thumbnails automatically attached to the Media Library along with their original images respectively.</p>
				</div>
			</div>
			<div id="tabs-2">
				<p style="display: flex; align-items: center;">
					Select folder: &nbsp;<?php 
                echo str_replace('folder_pilian', 'folder_pilian_aplod', $folderpil);
                ?>
&nbsp; 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">
				</p>
					<!--<p>Short Description: <input type="text" name="gdwpm_aplod_deskrip" value="" size="65" placeholder="Optional"></p>-->
				<p>
					<ul>
						<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 "Incoming" area (https://drive.google.com/drive/#incoming) in the new Google Drive UI.
						</dfn></li>
						<li><dfn>Accepted Media MIME types: */*</dfn>
						<!--	<br />&nbsp;<dfn>All Filetypes are allowed.</dfn>
						--></li>
					</ul> 
				</p>
				
<?php 
                $gdwpm_opsi_chunk = get_option('gdwpm_opsi_chunk');
                if (!$gdwpm_opsi_chunk || empty($gdwpm_opsi_chunk)) {
                    $gdwpm_opsi_chunk = array('local' => array('cekbok' => 'checked', 'chunk' => '700', 'retries' => '3'), 'drive' => array('cekbok' => 'checked', 'chunk' => '2', 'retries' => '3'));
                    update_option('gdwpm_opsi_chunk', $gdwpm_opsi_chunk);
                }
                $gdwpm_satpam_buat_nonce = wp_create_nonce('gdwpm_satpam_aplod_berkas');
                ?>
 
				<ul id="filelist"></ul>
				<br />
				<button id="gdwpm_tombol_bersih" style="display:none;float:right;">Clear List</button>
				<br />
				<br />
				<pre id="console"></pre>
				<div id="gdwpm_upload_container"><p id="gdwpm-pilih-kt">Choose your files: 
					<a id="gdwpm_tombol_browse" href="javascript:;"><button id="gdwpm_tombol_bk_folder">Browse</button></a></p>
					<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>
					<a style="display:none;" id="gdwpm_start-upload" href="javascript:;"><button id="gdwpm_tombol_upload">Upload to Google Drive</button></a>
				</div>
				<div id="gdwpm_loding_128" style="display:none;"><center>
				<img src="<?php 
                echo plugins_url('/images/animation/gdwpm_loader_128.gif', __FILE__);
                ?>
"><br/>Uploading...<br/><small id="respon_progress"></small></center></div>
 
<script type="text/javascript"> 
	var uploader = new plupload.Uploader({
		browse_button: 'gdwpm_tombol_browse', 
		url: '<?php 
                echo admin_url('admin-ajax.php?action=gdwpm_on_action&gdwpm_nonce_aplod_berkas=') . $gdwpm_satpam_buat_nonce;
                ?>
',
		<?php 
                if ($gdwpm_opsi_chunk['local']['cekbok'] == 'checked') {
                    echo "chunk_size: '" . $gdwpm_opsi_chunk['local']['chunk'] . "kb',";
                }
                ?>
		max_retries: <?php 
                echo $gdwpm_opsi_chunk['local']['retries'];
                ?>
	});
 
	uploader.init();
 
	uploader.bind('FilesAdded', function(up, files) {
		var html = '';
		plupload.each(files, function(file) {
			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>';
		});
		
		document.getElementById('filelist').innerHTML += html;
		jQuery('#console').empty();
		jQuery('#gdwpm_tombol_bersih').hide();
		jQuery('#gdwpm_start-upload').show();
		jQuery('#infopraupload').remove();
	});
 
	uploader.bind('UploadProgress', function(up, file) {
		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>";
		
		jQuery('#' + file.id + 'gdwpm_aplod_deskrip').hide();
		jQuery('#gdwpm_upload_container').hide();
		jQuery('#gdwpm_loding_128').show();
		jQuery('#gdwpm_tombol_bersih').hide();
	});
 
	uploader.bind('Error', function(up, err) {
		document.getElementById('console').innerHTML += "\nError #" + err.code + ": " + err.message;
		
		jQuery('#gdwpm_upload_container').show();
		jQuery('#gdwpm_loding_128').hide();
		jQuery('#gdwpm_start-upload').hide();
		jQuery('#gdwpm_tombol_bersih').show();
	});
	
	document.getElementById('gdwpm_start-upload').onclick = function() {
		uploader.start();
	};
	
	uploader.bind('FileUploaded', function(up, file, response ) {
        response=response["response"];
		jQuery('#console').html(response);
		
		var totalspan = document.getElementById('filelist').getElementsByClassName('hasilprog').length;
		var totaldfn = document.getElementById('filelist').getElementsByTagName('dfn').length;
		if(totalspan == totaldfn){
			jQuery('#gdwpm_upload_container').show();
			jQuery('#gdwpm_tombol_bersih').show();
			jQuery('#gdwpm_loding_128').hide();
		}
		jQuery('#gdwpm_start-upload').hide();
		jQuery('#respon_progress').empty();
		
		if(jQuery('#gdwpm_folder_anyar').val() != ''){
			jQuery('#gdwpm_info_folder_baru').show();
		}
	});
 
	uploader.bind('BeforeUpload', function (up, file) {
		up.settings.multipart_params = {gdpwm_nm_bks: jQuery("#folder_pilian_aplod option:selected").text(), gdpwm_nm_id: jQuery('select[name=folder_pilian_aplod]').val(), 
		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(),
		gdpwm_nama_file: file.name};
	});  
	
	uploader.bind('ChunkUploaded', function(up, file, info) {
		response=info["response"];
		jQuery('#respon_progress').empty();
		jQuery('#console').html(response);
		jQuery('#respon_progress').html('[Chunked: ' + info["offset"] + ' of ' + info["total"] + ' bytes]');
		
		//jQuery('#gdwpm_upload_container').show();
		//jQuery('#gdwpm_loding_128').hide();
		//jQuery('#gdwpm_start-upload').hide();
	}); 
</script>
			</div>
			<!-- tabs-3 ajax -->
			<!-- tabs-4 ajax -->
			<div id="tabs-5">
			<?php 
                $gdwpm_folder_tools_nonce = wp_create_nonce("gdwpm_folder_tools_nonce");
                ?>
				<div id="gdwpm_repair_folder" class="ui-widget-content ui-corner-all " style="padding:1em;">	
				<div class="ui-corner-all ui-widget-header" style="padding:0.5em;text-align:center;">Repair Folder
				</div>
				<form id="gdwpm_form_repair_folder" name="gdwpm_form_repair_folder" method="post">
				<p style="margin-left:7px;">
					<dfn>If you found that your folder was listed here, but not in your Google Drive "Incoming" area. <br/>
					Then, this tool will fix your hidden folder by change its permissions.</dfn>
				</p><br/>
					<input type="hidden" name="gdwpm_folder_tools_nonce" value="<?php 
                echo $gdwpm_folder_tools_nonce;
                ?>
">
					<p style="margin-left:17px;display: flex; align-items: center;">Select folder: &nbsp;<?php 
                echo str_replace(array('folder_pilian', ' disabled'), array('repair_folder_pilian', ''), $folderpil);
                ?>
 &nbsp;<button id="gdwpm_tombol_repair_folder" name="gdwpm_tombol_repair_folder"><?php 
                _e('Fix Now!');
                ?>
</button> &nbsp;&nbsp;
				</p>
				</form>
				</div>
				<br/>
				<div class="ui-widget-content ui-corner-all" style="padding:1em;">		
				<div class="ui-corner-all ui-widget-header" style="padding:0.5em;text-align:center;">Delete Folder and Files
				</div>
				<p>What do you want to do?</p>
				 <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> 
					Delete folder</p>
				<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> 
					Delete files</p>
				<br />
				<div id="gdwpm_kotak_buang_folder" class="ui-widget-content ui-corner-all" style="padding:1em;display:none;">	
				<div class="ui-corner-all ui-widget-header" style="padding:0.5em;text-align:center;">Delete Folder
				</div>
				<form id="gdwpm_form_buang_folder" name="gdwpm_form_buang_folder" method="post">
					<input type="hidden" name="gdwpm_folder_tools_nonce" value="<?php 
                echo $gdwpm_folder_tools_nonce;
                ?>
">
					<p style="display: flex; align-items: center;">Select folder to delete: &nbsp;<?php 
                echo str_replace('folder_pilian', 'buang_folder_pilian', $folderpil);
                ?>
 &nbsp;<button id="gdwpm_buang_folder" name="gdwpm_buang_folder"><?php 
                _e('Delete Now');
                ?>
</button> &nbsp;&nbsp;
						</form>
					</p>
				</div>
				<div id="gdwpm_kotak_buang_file" class="ui-widget-content ui-corner-all" style="padding:1em;display:none;">		
				<div class="ui-corner-all ui-widget-header" style="padding:0.5em;text-align:center;">Delete Files
				</div>				
				<p style="display: flex; align-items: center;">Select folder: &nbsp;<?php 
                echo str_replace(array('folder_pilian', ' disabled'), array('folder_pilian_file_del', ''), $folderpil);
                ?>
 &nbsp;<select id="pilihMaxResdel">
				<?php 
                for ($i = 1; $i <= 10; $i++) {
                    $inum = $i * 10;
                    ?>
				<option value="<?php 
                    echo $inum;
                    ?>
"><?php 
                    echo $inum;
                    ?>
 items/page</option>				
				<?php 
                }
                ?>
				</select> &nbsp;<button id="gdwpm_file_dr_folder" name="gdwpm_file_dr_folder"><?php 
                _e('Get Files');
                ?>
</button> &nbsp;&nbsp;
					
				<p>
					<span class="sukses_del">Please select folder and click Get Files, to show all files belongs to it.
				</span>
				</p>
				
				<div style="display: none" id="gdwpm_loading_gbr_del">
				  <center><img src="<?php 
                echo plugins_url('/images/animation/gdwpm_loader_256.gif', __FILE__);
                ?>
" /><br />Please wait...</center>
				</div>
				<form id="gdwpm_form_buang_berkas" name="gdwpm_form_buang_berkas" method="post">	
					<input type="hidden" name="gdwpm_folder_tools_nonce" value="<?php 
                echo $gdwpm_folder_tools_nonce;
                ?>
">
					<div id="hasil_del"></div>
					<div style="display: none" id="gdwpm_info_del"><p>Selected file(s) will be permanently deleted. Are you ready?</p>
						<p>
							<button id="gdwpm_berkas_buang" name="gdwpm_berkas_buang">Delete Selected</button>
						</p>
					</div>
				</form>
				<div id="vaginasi_del" style="text-align:center;margin-top:25px;"></div>
				</div>
<div id="dialog-buang-folder" title="Confirm Deletion" style="display: none;">
  <p>
    <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>
    Are you sure want to delete this folder?
  </p>
  <p>
    All files in this folder will be permanently deleted and cannot be recovered.
  </p>
</div>
<div id="dialog-buang-berkas" title="Confirm Deletion" style="display: none;">
  <p>
    <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>
    Are you sure want to delete selected file(s)?
  </p>
  <p>
    All selected files will be permanently deleted and cannot be recovered.
  </p>
</div>
			</div>
			</div>
<script>
function gdwpm_cekbok_opsi_buang_folder_eksen(){
		document.getElementById("gdwpm_kotak_buang_folder").style.display = "block";
		document.getElementById("gdwpm_kotak_buang_file").style.display = "none";
}
function gdwpm_cekbok_opsi_buang_file_eksen(){
		document.getElementById("gdwpm_kotak_buang_file").style.display = "block";
		document.getElementById("gdwpm_kotak_buang_folder").style.display = "none";
}
jQuery(function(){
        jQuery('#dialog-buang-folder').dialog({
            autoOpen: false,
            modal: true,
            width: 350,
            resizable: false,
            buttons: {
                "Yes, sure!": function() {
                    document.gdwpm_form_buang_folder.submit();
                },
                "Cancel": function() {
                    jQuery(this).dialog("close");
                }
            }
        });
         
        jQuery('form#gdwpm_form_buang_folder').submit(function(e){
            e.preventDefault();
 
            jQuery('#dialog-buang-folder').dialog('open');
        });
		
        jQuery('#dialog-buang-berkas').dialog({
            autoOpen: false,
            modal: true,
            width: 350,
            resizable: false,
            buttons: {
                "Yes, I do!": function() {
                    document.gdwpm_form_buang_berkas.submit();
                },
                "Cancel": function() {
                    jQuery(this).dialog("close");
                }
            }
        });
         
        jQuery('form#gdwpm_form_buang_berkas').submit(function(e){
            e.preventDefault();
 
            jQuery('#dialog-buang-berkas').dialog('open');
        });
});
</script>
<?php 
            } else {
                ?>
			<div id="tabs-6">
				<p>
					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/>
					For more info about "Incoming" or "Shared with me", please visit <dfn>https://support.google.com/drive/answer/2375057?hl=en</dfn>.
				</p>
				<p>
					Once the folder created, your folder will be listed in the "Incoming" or "Shared with me" area <dfn>https://drive.google.com/drive/#incoming</dfn>.
				</p>
				<p>
					This plugin requires at least 1 folder to store your files.
				</p>
				<form name="gdwpm_form_gawe_folder" method="post" action="<?php 
                echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
                ?>
">
					<?php 
                $gdwpm_gawe_folder_nonce = wp_create_nonce("gdwpm_gawe_folder_nonce");
                ?>
					<input type="hidden" name="gdwpm_gawe_folder_nonce" value="<?php 
                echo $gdwpm_gawe_folder_nonce;
                ?>
">
					<p>
						Folder Name: <input type="text" name="gdwpm_gawe_folder" value="" placeholder="Alphanumeric only"> <button id="simpen_gawe_folder"><?php 
                _e('Create Folder');
                ?>
</button>
					</p>
				</form>
			</div>
<?php 
            }
            ?>
		</div>
	</div>
 <?php 
            if (!empty($foldercek)) {
                ?>
		<h3>Galleries [Alpha: experimental]</h3>
	<div>
		<?php 
                $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");
                $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");
                ?>
		<div id="gdwpm-albums" style="margin:0 -12px 0 -12px;">
			<ul>
				<li><a href="<?php 
                echo $gdwpm_url_tab_albums;
                ?>
"><span style="float:left" class="ui-icon ui-icon-contact"></span>&nbsp;Albums</a></li>
				<li><a href="<?php 
                echo $gdwpm_url_tab_galleries;
                ?>
"><span style="float:left" class="ui-icon ui-icon-image"></span>&nbsp;Galleries</a></li>
				<li><a href="#gdwpm-albums-3"><span style="float:left" class="ui-icon ui-icon-cart"></span>&nbsp;Gallery Creator</a></li>
			</ul>
			<!-- <div id="gdwpm-albums-1"></div> -->
			<!-- <div id="gdwpm-albums-2"></div> -->
			<div id="gdwpm-albums-3">
				<p style="display: flex; align-items: center;">Select folder: &nbsp;<?php 
                echo str_replace('folder_pilian', 'folder_pilian_file_gal', $folderpil);
                ?>
 &nbsp;<select id="pilihMaxResgal">
				<?php 
                for ($i = 1; $i <= 10; $i++) {
                    $inum = $i * 10;
                    ?>
				<option value="<?php 
                    echo $inum;
                    ?>
"><?php 
                    echo $inum;
                    ?>
 items/page</option>				
				<?php 
                }
                ?>
				</select> &nbsp;<button id="gdwpm_file_gallery" name="gdwpm_file_gallery"><?php 
                _e('Get Files');
                ?>
</button> &nbsp;&nbsp;
				<p>		
				<p>
					<span class="sukses_gal">Please select folder and click Get Files, to show all files belongs to it.
				</span>
				</p>
				<div style="display: none" id="gdwpm_loading_gbr_gal">
				  <center><img src="<?php 
                echo plugins_url('/images/animation/gdwpm_loader_256.gif', __FILE__);
                ?>
" /><br />Please wait...</center>
				</div>
				<div id="hasil_gal"></div>
				<div id="vaginasi_gal" style="text-align:center;margin-top:25px;"></div>
				<div style="display: none" id="gdwpm_masuk_gallery_teks"><p>Collect your images to create a new Gallery.</p>
					<p><span style="display: none" id="gdwpm_masuk_gallery_anim">
							<img src="<?php 
                echo plugins_url('/images/animation/loading-bar-image.gif', __FILE__);
                ?>
" />
						</span>
						<button id="gdwpm_berkas_masuk_gallery" name="gdwpm_berkas_masuk_gallery">Add to Collector</button>&nbsp;&nbsp;&nbsp; 
						<span style="display: none" id="gdwpm_add_to_gal_gbr">
							<img src="<?php 
                echo plugins_url('/images/animation/loading-bar-image.gif', __FILE__);
                ?>
" />
						</span>
						<span id="gdwpm_info_masuk_gallery"></span>
					</p>
				</div>
				<br/>
				<div id="gallery_box" class="ui-widget-content ui-helper-clearfix ui-corner-all" style="padding:1em 1em 3em 1em;position:relative;">
					<div class="ui-corner-all ui-widget-header" style="margin-bottom:20px;padding:0.5em;text-align:center;">Collector</div>
					<div id="gallery_holder">
					</div>
					<span id="gallery_box_info" style="display:none;position:absolute;bottom:5px;right:15px;">
						<small style="opacity:0.5;"><i>*Drag to reorder.</i></small>
					</span>
				</div>
				<br/>
				<div id="gallery_input" style="display:none;">
					<p id="gal_intermezo" style="text-align:center;">Your Gallery is ready to be published..</p>
					 <span style="display: flex; align-items: center;"><label for="gallery_category" style="display:inline-block;width:110px;">Album </label>: &nbsp;<select id="old_album">
					<?php 
                $terms = get_terms('gdwpm_album');
                if (!empty($terms) && !is_wp_error($terms)) {
                    foreach ($terms as $term) {
                        ?>
		
						<option value="<?php 
                        echo $term->name;
                        ?>
"><?php 
                        echo $term->name;
                        ?>
</option>				
					<?php 
                    }
                } else {
                    ?>
						<option value="Uncategorized">Uncategorized</option>				
					<?php 
                }
                ?>
	
					</select> &nbsp;or create a new album : &nbsp;<input type="text" name="new_album" id="new_album" value="" size="16" placeholder="New Album Name" />
					</span><br/>
					<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" />
					<br/><br/>
					<span style="display: flex; align-items: center;">
					<label for="gallery_style" style="display:inline-block;width:110px;">Images List </label>: &nbsp;<select id="css_style"><option value="default">Default</option><option value="justified">Justified</option></select></span>
					<br/>	
					<span id="css_style_opt" style="display: flex; align-items: center;">
						<label for="css_style_default" style="margin-left:140px;display:inline-block;width:150px;">Number of columns </label>: &nbsp;<select id="css_style_default">
						<?php 
                for ($kenyot = 3; $kenyot < 10; $kenyot++) {
                    ?>
							<option value="<?php 
                    echo $kenyot;
                    ?>
"><?php 
                    echo $kenyot;
                    ?>
</option><?php 
                }
                ?>
</select>
					</span>
					
					<span id="css_style_opt1">
						<span style="display: flex; align-items: center;">
							<label for="css_justified_margins" style="margin-left:140px;display:inline-block;width:100px;">margins</label>:&nbsp;<select id="css_justified_margins"><?php 
                for ($ciblek = 1; $ciblek < 11; $ciblek++) {
                    ?>
							<option value="<?php 
                    echo $ciblek;
                    ?>
"><?php 
                    echo $ciblek;
                    ?>
 px</option><?php 
                }
                ?>
</select>
						</span><br/>
						<span style="display: flex; align-items: center;">
							<label for="css_justified_row" style="margin-left:140px;display:inline-block;width:100px;">rowHeight</label>:&nbsp;<select id="css_justified_row"><?php 
                for ($jemek = 5; $jemek < 20; $jemek++) {
                    ?>
							<option value="<?php 
                    echo $jemek * 10;
                    ?>
"><?php 
                    echo $jemek * 10;
                    ?>
 px</option><?php 
                }
                ?>
							</select>
						</span><br/>
						<span style="display: flex; align-items: center;">
							<label for="css_justified_last" style="margin-left:140px;display:inline-block;width:100px;">lastRow</label>:&nbsp;<select id="css_justified_last"><option value="justify">Justify</option><option value="nojustify">Nojustify</option><option value="hide">Hide</option></select>
						</span>
					</span>
					<br/>					
					<span style="display: flex; align-items: center;">
					<label for="css_effect" style="display:inline-block;width:110px;">Effect </label>: &nbsp;<select id="css_effect"><option value="default">Default</option><option value="blackwhite">Black & White</option><option value="lighthover">Light on Hover</option></select>
					</span><br/>
					
					<span style="display: flex; align-items: center;">
					<label for="gallery_jquery" style="display:inline-block;width:110px;">Image Viewer </label>: &nbsp;<select id="gallery_jquery"><option value="lightbox">Lightbox</option></select>
					</span><br/><br/>
					<input type="hidden" id="gallery_id_edit" value="" />
					<button id="gdwpm_new_gallery" class="gdwpm_bikin_gallery">Create Gallery</button>
					<button id="gdwpm_edit_gallery" class="gdwpm_bikin_gallery" style="display:none;">Update Gallery</button>
					<span style="margin-left:300px;" id="gdwpm_reset_gallery"><a href="#"><small>Reset / Cancel</small></a></span>
				</div>
				<div id="gdwpm_creating_128" style="display:none;text-align:center;">
				<img src="<?php 
                echo plugins_url('/images/animation/gdwpm_loader_128.gif', __FILE__);
                ?>
"><br/>Please wait..</div>
				<div id="gallery_input_info">		</div>
			</div>
		</div>
	</div>
<?php 
            }
        }
        ?>
		<h3>Settings</h3>
	<div>
		<?php 
        $gdwpm_tabulasi_themeset_nonce = wp_create_nonce("gdwpm_tabulasi_themeset_nonce");
        $gdwpm_url_tab_themeset = admin_url('admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=themeset&gdwpm_tabulasi_themeset_nonce=') . $gdwpm_tabulasi_themeset_nonce;
        ?>
		<div id="gdwpm-settingtabs" style="margin:0 -12px 0 -12px;">
			<ul>
				<li><a href="#gdwpm-settingtabs-1"><span style="float:left" class="ui-icon ui-icon-key"></span>&nbsp;Google Drive API Key</a></li>
				<li><a href="<?php 
        echo $gdwpm_url_tab_themeset;
        ?>
"><span style="float:left" class="ui-icon ui-icon-video"></span>&nbsp;Themes</a></li>
			</ul>
			<div id="gdwpm-settingtabs-1">
			
				<table id="gdwpm_form_konci">
					<tr>
						<td>
				<form name="gdwpm_isi_akun" method="post" action="<?php 
        echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
        ?>
">
							Google Email
						</td>
						<td>: </td>
						<td>
							<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">
						</td>
					</tr>
					<tr>
						<td>
							Client ID
						</td>
						<td>: </td>
						<td>
							<input type="text" name="gdwpm_klaen_aidi" value="<?php 
        echo $gdwpm_opt_akun[1];
        ?>
"  title="eg: 123456789.apps.googleusercontent.com" size="45">
						</td>
					</tr>
					<tr>
						<td>
							Service Account Name
						</td>
						<td>: </td>
						<td>
							<input type="text" name="gdwpm_nama_service" value="<?php 
        echo $gdwpm_opt_akun[2];
        ?>
"  title="eg: 123456789@developer.gserviceaccount.com" size="45">
						</td>
					</tr>
					<tr>
						<td>
					Private Key Url Path
						</td>
						<td>: </td>
						<td>
							<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">
						</td>
					</tr>
				</table>
					<br />
					
					<?php 
        $gdwpm_akun_nonce = wp_create_nonce("gdwpm_akun_nonce");
        ?>
			
						<input type="hidden" name="gdwpm_akun_nonce" value="<?php 
        echo $gdwpm_akun_nonce;
        ?>
">
						<p style="margin-left:35px;">
							<button type="submit" id="simpen_gdwpm_akun"><?php 
        _e('Save');
        ?>
</button>
						</p>		
				</form>
			</div>
		</div>
	</div>
<?php 
    } else {
        $cek_kunci = 'false';
    }
    ?>
		<h3>Documentation</h3>
	<div>
		<?php 
    $gdwpm_tabulasi_nonce = wp_create_nonce("gdwpm_tabulasi_ajax");
    $gdwpm_url_tab_dok = admin_url('admin-ajax.php?action=gdwpm_on_action&gdwpm_tabulasi=apidoku&gdwpm_tabulasi_nonce=') . $gdwpm_tabulasi_nonce;
    ?>
		<div id="doktabs" style="margin:0 -12px 0 -12px;">
			<ul>
				<li><a href="#doktabs-1"><span style="float:left" class="ui-icon ui-icon-note"></span>&nbsp;Requirements</a></li>
				<li><a href="<?php 
    echo $gdwpm_url_tab_dok;
    ?>
"><span style="float:left" class="ui-icon ui-icon-suitcase"></span>&nbsp;Google Drive API</a></li>
			</ul>
			<div id="doktabs-1">
				<h3>Minimum requirements</h3>
				<p>
					PHP <?php 
    echo MINPHP_GDWPM;
    ?>
 with cURL enabled.
				</p>
				<p>
					<span style="float:left" class="ui-icon ui-icon-info"></span>&nbsp;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';
    }
    ?>
.
				</p>
			</div>
		</div>
	</div>
		<h3>About</h3>
	<div>
		<p>
			<?php 
    echo NAMA_GDWPM;
    ?>
 current installed version is <?php 
    echo VERSI_GDWPM;
    ?>
		</p>
		<p>
			<?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).
			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.
		</p>
		<p>
			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.
		</p>
		<p>
			If you do not find an answer there, please open a new thread in the WordPress Support Forums.
		</p>
		<p style="margin-top:57px;">
			Special thanks to everyone for the donations, you are one of my reasons why this plugin is actively maintained and updated.
		</p>
		<p>
			Thank You!
		</p>
		<small>
			Credits:
			<ul>
				<li>Google Drive API & products are owned by Google inc.</li> 
				<li>Table Style credit to R. Christie (SmashingMagazine).</li> 
				<li>DriveServiceHelper Class credit to Lukasz Kujawa.</li> 
				<li>JQuery Upload credit to PLUpload by Moxiecode Systems AB.</li> 
				<li>JQuery User Interface by JQueryUI.</li> 
				<li>Alternative openssl sign function by Rochelle Alder.</li> 
				<li>Lightbox by Lokesh Dhakar.</li> 
				<li>Justified Gallery by Miro Mannino.</li> 
			</ul>
		</small>
	</div>
</div>
<div id="dialog-message" title="Warning" style="display: none;">
  <p>
    <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>
    This plugin requires api key to authorize your drive.
  </p>
  <p>
    Click the documentation tab for more info.
  </p>
</div>
<div id="gdwpm_pringatan_versi_php" title="Warning" style="display: none;">
  <p>
    <span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 50px 0;"></span>
    Sorry, You can't use this plugin with your current PHP version.<br>This plugin requires <b>PHP <?php 
    echo MINPHP_GDWPM;
    ?>
</b>.<br>
	Your PHP version is <b><?php 
    echo phpversion();
    ?>
</b>.
  </p>
  <p>
    Please upgrade your PHP to <?php 
    echo MINPHP_GDWPM;
    ?>
.
  </p>
</div>
<script>
   function gantiBaris(sel, tableid) {
    var jumlahBaris = sel.value;
    jumBaris(jumlahBaris, tableid);
   }
   function remove_itemgal(e) {
		e.parentNode.parentNode.removeChild(e.parentNode);
		if (jQuery('#gallery_holder > div').length > 1){
			jQuery('#gallery_input').show();
		}else{
			jQuery('#gallery_input').hide();
			jQuery('#gallery_box_info').hide();
		}
   }

  jQuery(function() {
    jQuery( "#gdwpm_pringatan_versi_php" ).dialog({
      autoOpen: <?php 
    echo $gdwpm_cek_php;
    ?>
,
      modal: true,
      width: 350,
      resizable: false,
      buttons: {
        Ok: function() {
          jQuery( this ).dialog( "close" );
        }
      }
    });
    jQuery( "#dialog-message" ).dialog({
      autoOpen: <?php 
    if (isset($errorkon)) {
        echo 'false';
    } else {
        echo $cek_kunci;
    }
    ?>
,
      modal: true,
      width: 350,
      resizable: false,
      buttons: {
        Ok: function() {
          jQuery( this ).dialog( "close" );
        }
      }
    });
  
    jQuery( "#gallery_holder" ).sortable()
    jQuery( "#gallery_holder" ).disableSelection()
    jQuery( "#golek_seko_folder, #gdwpm_file_dr_folder, #gdwpm_file_gallery" )
      .button({
      icons: {
        primary: "ui-icon-circle-arrow-s"
      }
    })
  
    jQuery( "#gdwpm_buang_folder" )
      .button({
      icons: {
        primary: "ui-icon-trash"
      }
    })
	
    jQuery( "#gdwpm_berkas_buang" )
      .button({
      icons: {
        primary: "ui-icon-trash"
      }
    })
	
    jQuery( "#gdwpm_tombol_info_folder_baru" )
      .button({
      icons: {
        primary: "ui-icon-refresh"
      }
    })
	
    jQuery( "#gdwpm_berkas_masuk_perpus" )
      .button({
      icons: {
        primary: "ui-icon-circle-plus"
      }
    })
	
    jQuery( "#gdwpm_berkas_masuk_gallery" )
      .button({
      icons: {
        primary: "ui-icon-cart"
      }
    })
	
    jQuery( ".gdwpm_bikin_gallery" )
      .button({
      icons: {
        primary: "ui-icon-image"
      }
    })
	
    jQuery( "#gdwpm_tombol_bk_folder" )
      .button({
      icons: {
        primary: "ui-icon-folder-open"
      }
    })
	
    jQuery( "#gdwpm_tombol_bersih" )
      .button({
      icons: {
        primary: "ui-icon-grip-dotted-horizontal"
      }
    })
	
    jQuery( "#gdwpm_tombol_upload" )
      .button({
      icons: {
        primary: "ui-icon-arrowthickstop-1-n"
      }
    })
	
    jQuery( "#simpen_gdwpm_akun" )
      .button({
      icons: {
        primary: "ui-icon-person"
      }
    })
		
    jQuery( "#simpen_gawe_folder" )
      .button({
      icons: {
        primary: "ui-icon-folder-collapsed"
      }
    })  
    jQuery( "#gdwpm_tombol_repair_folder" )
      .button({
      icons: {
        primary: "ui-icon-wrench"
      }
    })
<?php 
    if (version_compare(get_bloginfo('version'), '4.0', '>')) {
        ?>
		
	jQuery( "#pilihMaxRes" )
	  .selectmenu();
	jQuery( "#pilihMaxResdel" )
	  .selectmenu();
	jQuery( "#pilihMaxResgal" )
	  .selectmenu();
	  
	jQuery( "#folder_pilian" )
	  .selectmenu()
	  .selectmenu( "menuWidget" )
		.addClass( "overflowpil" );
	jQuery( "#folder_pilian_aplod" )
	  .selectmenu()
	  .selectmenu( "menuWidget" )
		.addClass( "overflowapl" );
	jQuery( "#buang_folder_pilian" )
	  .selectmenu()
	  .selectmenu( "menuWidget" )
		.addClass( "overflowbua" );
	jQuery( "#repair_folder_pilian" )
	  .selectmenu()
	  .selectmenu( "menuWidget" )
		.addClass( "overflowrep" );
	jQuery( "#folder_pilian_file_del" )
	  .selectmenu()
	  .selectmenu( "menuWidget" )
		.addClass( "overflowdel" );
	jQuery( "#folder_pilian_file_gal" )
	  .selectmenu()
	  .selectmenu( "menuWidget" )
		.addClass( "overflowgal" );
	jQuery( "#old_album, #css_effect, #css_style_default, #css_justified_margins, #css_justified_row, #css_justified_last, #gallery_jquery" )
	  .selectmenu()
	  .selectmenu( "menuWidget" )
		.addClass( "overflowolal" );
	jQuery( "#css_style" )
	  .selectmenu({ change: function( event, ui ) { 
		if(jQuery( this ).val() == 'default'){
			jQuery('#css_style_opt').show();
			jQuery('#css_style_opt1').hide();
		}else{
			jQuery('#css_style_opt').hide();
			jQuery('#css_style_opt1').show();
		}
	}})
	  .selectmenu( "menuWidget" )
		.addClass( "overflowolal" );
<?php 
    }
    ?>
	jQuery('input').addClass("ui-corner-all");
  });
</script>
<?php 
}
Ejemplo n.º 2
0
}
if (!class_exists('Google_Client')) {
    require_once 'gdwpm-api/Google_Client.php';
    require_once 'gdwpm-api/contrib/Google_DriveService.php';
}
if (!$gdwpm_opt_akun) {
    $gdwpm_opt_akun = get_option('gdwpm_akun_opt');
    // imel, client id, gdwpm_service akun, private key
    $cek_kunci = 'false';
}
$gdwpm_apiConfig['use_objects'] = true;
if (!$gdwpm_service) {
    $gdwpm_service = new GDWPMBantuan($gdwpm_opt_akun[1], $gdwpm_opt_akun[2], $gdwpm_opt_akun[3]);
}
if (!isset($ebot)) {
    $ebot = $gdwpm_service->getAbout();
}
?>
<table id="gdwpm_info_akun">
	<tr>
		<td>Service Account Name</td><td>: </td>
		<td title="The name of the current user."><?php 
echo $ebot->getName();
?>
</td>
	</tr>
	<tr>
		<td>Total quota</td><td>: </td>
		<td title="The total number of quota bytes."><?php 
echo size_format($ebot->getQuotaBytesTotal(), 2) . ' (' . $ebot->getQuotaBytesTotal() . ' bytes)';
?>