Changeset 2793340
- Timestamp:
- 10/03/2022 09:23:20 AM (3 years ago)
- Location:
- cloud-customer-area
- Files:
-
- 18 added
- 6 edited
-
tags/1.1.9 (added)
-
tags/1.1.9/assets (added)
-
tags/1.1.9/assets/admin-ui.css (added)
-
tags/1.1.9/assets/folder.svg (added)
-
tags/1.1.9/assets/frontend.css (added)
-
tags/1.1.9/assets/frontend.js (added)
-
tags/1.1.9/assets/loading.svg (added)
-
tags/1.1.9/cloud-customer-area.php (added)
-
tags/1.1.9/inc (added)
-
tags/1.1.9/inc/functions.php (added)
-
tags/1.1.9/inc/google-api.php (added)
-
tags/1.1.9/index.php (added)
-
tags/1.1.9/part (added)
-
tags/1.1.9/part/settings_page.php (added)
-
tags/1.1.9/part/settings_page_customize.php (added)
-
tags/1.1.9/part/settings_page_main.php (added)
-
tags/1.1.9/part/settings_page_oauth.php (added)
-
tags/1.1.9/readme.txt (added)
-
trunk/assets/frontend.css (modified) (1 diff)
-
trunk/assets/frontend.js (modified) (1 diff)
-
trunk/cloud-customer-area.php (modified) (3 diffs)
-
trunk/inc/functions.php (modified) (1 diff)
-
trunk/inc/google-api.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cloud-customer-area/trunk/assets/frontend.css
r2310114 r2793340 123 123 border-bottom: 0; 124 124 } 125 126 .cloud-customer-area-icon { 127 height: 16px; 128 width: 16px; 129 display: inline-block; 130 margin: 0 5px; 131 vertical-align: text-bottom; 132 } -
cloud-customer-area/trunk/assets/frontend.js
r2310114 r2793340 17 17 load_el.remove(); 18 18 $.each( data, function( key, value ) { 19 $(table_el).append( '<tr><td>'+ value.name +'</td><td>'+ value.date +'</td><td>'+ value.ext +'</td><td>'+ value.download_link +'</td></tr>' ); 19 var icon = value.icon.length > 0 ? '<span class="cloud-customer-area-icon" style="background-image: url('+ value.icon +')"></span>' : ''; 20 $(table_el).append( '<tr><td>'+ value.name +'</td><td>'+ value.date +'</td><td>'+ icon + value.ext +'</td><td>'+ value.download_link +'</td></tr>' ); 20 21 }); 21 22 }, -
cloud-customer-area/trunk/cloud-customer-area.php
r2585315 r2793340 8 8 Text Domain: cloud-customer-area 9 9 Domain Path: /languages/ 10 Version: 1.1. 810 Version: 1.1.9 11 11 */ 12 12 … … 168 168 169 169 if (isset($_GET['action']) && $_GET['action'] == 'download' && isset($_GET['download_name']) && isset($_GET['download_id']) && isset($_GET['token']) && (!in_array('guest', $customer_roles) ? wp_verify_nonce($_GET['token'], CCA_SLUG . '_download') : true)) { 170 CCA_googleApi_downloadFile($_GET['download_name'], $_GET['download_id'] );170 CCA_googleApi_downloadFile($_GET['download_name'], $_GET['download_id'], (!empty($_GET['export']) ? $_GET['export'] : false)); 171 171 exit; 172 172 } else { … … 224 224 $time = explode('T', $file->modifiedTime)[1]; 225 225 $time = explode(':', $time)[0] . ':' . explode(':', $time)[1]; 226 226 $download_args = [ 227 'action' => 'download', 228 'download_name' => urlencode($file->name), 229 'download_id' => $file->id, 230 'token' => wp_create_nonce(CCA_SLUG . '_download') 231 ]; 232 if(strpos($file->mimeType, 'application/vnd.google-apps') !== false){ 233 $download_args['export'] = str_replace('application/vnd.google-apps.', '', $file->mimeType); 234 } 235 $download_link = add_query_arg($download_args, site_url()); 227 236 $return_output[] = array( 228 237 'name' => $file->name, 229 238 'date' => $date, 230 'ext' => $file->fileExtension, 231 'download_link' => '<a href="' . site_url() . '/?action=download&download_name=' . urlencode($file->name) . '&download_id=' . $file->id . '&token=' . wp_create_nonce(CCA_SLUG . '_download') . '" target="_blank">' . __(CCA_getSetting('label_download', 'customize'), 'cloud-customer-area') . '</a>', 239 'ext' => !empty($file->fileExtension) ? $file->fileExtension : '', 240 'icon' => !empty($file->iconLink) ? $file->iconLink : '', 241 'download_link' => '<a href="' . $download_link . '" target="_blank">' . __(CCA_getSetting('label_download', 'customize'), 'cloud-customer-area') . '</a>', 232 242 ); 233 243 } -
cloud-customer-area/trunk/inc/functions.php
r2539690 r2793340 210 210 } 211 211 212 function CCA_googleApi_downloadFile($fileName, $fileId) 213 { 214 $google_api = CCA_googleApi_init(); 215 $access_token = CCA_getSetting('access_token', 'oauth'); 216 $get_file = $google_api->getFile($access_token, $fileId); 212 function CCA_googleApi_downloadFile($fileName, $fileId, $export = false) 213 { 214 $google_api = CCA_googleApi_init(); 215 $access_token = CCA_getSetting('access_token', 'oauth'); 216 $get_file = $google_api->getFile($access_token, $fileId, $export); 217 $fileExportTypeMap = [ 218 'audio' => '.mp3', 219 'document' => '.docx', 220 'drawing' => '.pdf', 221 'file' => '', 222 'presentation' => '.pptx', 223 'spreadsheet' => '.xlsx' 224 ]; 225 if($export && !empty($fileExportTypeMap[$export])){ 226 $fileName .= $fileExportTypeMap[$export]; 227 } 217 228 header('Content-Type: application/octet-stream'); 218 229 header("Content-Transfer-Encoding: Binary"); -
cloud-customer-area/trunk/inc/google-api.php
r2539690 r2793340 124 124 $args = array( 125 125 'key' => $this->client_id, 126 'fields' => 'nextPageToken, files(id, name, thumbnailLink, fileExtension, modifiedTime )',126 'fields' => 'nextPageToken, files(id, name, thumbnailLink, fileExtension, modifiedTime, mimeType, iconLink, properties)', 127 127 ); 128 128 if (!empty($q)) { … … 154 154 } 155 155 156 public function getFile($token = '', $fileID = false )156 public function getFile($token = '', $fileID = false, $export = false) 157 157 { 158 158 if (!isset($token->access_token)) { 159 159 return false; 160 160 } 161 $fileExportTypeMap = [ 162 'audio' => 'audio/mpeg', 163 'document' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 164 'drawing' => 'application/pdf', 165 'file' => 'application/octet-stream', 166 'presentation' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 167 'spreadsheet' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' 168 ]; 161 169 $headers = array( 162 170 'Authorization' => 'Bearer "' . $token->access_token . '"', 163 171 ); 164 $response = $this->sendAPIRequest('https://www.googleapis.com/drive/v3/files/' . $fileID . '/?alt=media', '', 'GET', $headers); 172 if($export){ 173 if(empty($fileExportTypeMap[$export])){ 174 return 'Error'; 175 } 176 $response = $this->sendAPIRequest('https://www.googleapis.com/drive/v3/files/' . $fileID . '/export?mimeType=' . $fileExportTypeMap[$export], '', 'GET', $headers); 177 } else { 178 $response = $this->sendAPIRequest('https://www.googleapis.com/drive/v3/files/' . $fileID . '/?alt=media', '', 'GET', $headers); 179 } 165 180 return $response; 166 181 } -
cloud-customer-area/trunk/readme.txt
r2585315 r2793340 4 4 Donate link: https://totalpress.org/donate?utm_source=wordpress_org&utm_medium=plugin_page&utm_campaign=cloud_customer_area 5 5 Requires at least: 4.0 6 Tested up to: 5.87 Stable tag: 1.1. 86 Tested up to: 6.0 7 Stable tag: 1.1.9 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later … … 40 40 This plugin is written using only **functions included in the WordPress core**, so it does **not reduce the performance of your website** and does **not cause compatibility problems**. 41 41 You can use the "Cloud Customer Area" plugin with **any theme builder**, with any theme and with **any plugin**. It's perfect! 42 43 **Files created with Google apps can be downloaded via the plugin only if the size does not exceed 10mb.** 42 44 43 45 == Cloud Customer Area features == … … 99 101 == Changelog == 100 102 103 = 1.1.9 = 104 * WP 6.0 compatibility; 105 * Export Google apps file; 106 101 107 = 1.1.8 = 102 108 * WP 5.8 compatibility. … … 127 133 128 134 == Upgrade Notice == 135 136 = 1.1.9 = 137 WP 6.0 compatibility; 138 Export Google apps file; 129 139 130 140 = 1.1.8 =
Note: See TracChangeset
for help on using the changeset viewer.