当前位置: 首页>>代码示例>>PHP>>正文


PHP dropbox::deleteFile方法代码示例

本文整理汇总了PHP中dropbox::deleteFile方法的典型用法代码示例。如果您正苦于以下问题:PHP dropbox::deleteFile方法的具体用法?PHP dropbox::deleteFile怎么用?PHP dropbox::deleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dropbox的用法示例。


在下文中一共展示了dropbox::deleteFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete_backup

 public static function delete_backup()
 {
     if (isset($_POST['backup-type'])) {
         if ($_POST['backup-type'] == 'local') {
             require_once DRBBACKUP_BASE_DIR . "/modules/class-wpadm-core.php";
             $dir = DROPBOX_BACKUP_DIR_BACKUP . '/' . $_POST['backup-name'];
             $delete = false;
             if (is_dir($dir)) {
                 WPAdm_Core::rmdir($dir);
                 $delete = true;
             }
             $dir = ABSPATH . WPADM_DIR_NAME . '/' . $_POST['backup-name'];
             if (is_dir($dir)) {
                 WPAdm_Core::rmdir($dir);
                 $delete = true;
             }
             $dir = WPADM_DIR_BACKUP . '/' . $_POST['backup-name'];
             if (is_dir($dir)) {
                 WPAdm_Core::rmdir($dir);
                 $delete = true;
             }
             if ($delete) {
                 parent::setMessage(str_replace('%s', $_POST['backup-name'], langWPADM::get('Backup(%s) was deleted', false)));
             }
         } elseif ($_POST['backup-type'] == 'dropbox') {
             require_once DRBBACKUP_BASE_DIR . "/modules/dropbox.class.php";
             $dropbox_options = get_option(PREFIX_BACKUP_ . 'dropbox-setting');
             if ($dropbox_options) {
                 $dropbox_options = unserialize(base64_decode($dropbox_options));
                 $dropbox = new dropbox($dropbox_options['app_key'], $dropbox_options['app_secret'], $dropbox_options['auth_token_secret']);
                 $folder_project = self::getNameProject();
                 $res = $dropbox->deleteFile("{$folder_project}/{$_POST['backup-name']}");
                 if ($res['is_deleted'] === true) {
                     parent::setMessage(str_replace('%s', $_POST['backup-name'], langWPADM::get('Backup(%s) was deleted', false)));
                 }
             }
         }
     }
     header("Location: " . admin_url("admin.php?page=wpadm_wp_full_backup_dropbox"));
 }
开发者ID:derwegas,项目名称:strubbelkinder,代码行数:40,代码来源:wpadm-class-wp.php

示例2: execute

 public function execute(WPAdm_Command_Context $context)
 {
     @session_start();
     require_once WPAdm_Core::getPluginDir() . '/modules/dropbox.class.php';
     WPAdm_Core::log(langWPADM::get('Send to dropbox files', false));
     $dropbox = new dropbox($context->get('key'), $context->get('secret'), $context->get('token'));
     if (!$dropbox->isAuth()) {
         $context->setError(langWPADM::get('Website "%d" can\'t authorize on Dropbox with using of "app key: %k" and "app secret: %s"', false, array('%d', '%k', '%s'), array(SITE_HOME, $context->get('key'), $context->get('secret'))));
         return false;
     }
     $files = $context->get('files');
     $file = explode("/", $files);
     $file_name = array_pop($file);
     $folder_project_temp = $context->get('folder_project');
     $folder_project = "";
     if (!empty($folder_project_temp)) {
         $folder_project = $folder_project_temp . "/";
         $dropbox->createDir($folder_project_temp);
         $dropbox->createDir($folder_project . $context->get('folder'));
     } else {
         $dropbox->createDir($context->get('folder'));
     }
     $fromFile = str_replace('//', '/', $files);
     $toFile = str_replace('//', '/', $folder_project . $context->get('folder') . '/' . $file_name);
     $local = $context->get('local');
     $file_dropbox = $dropbox->listing($folder_project . $context->get('folder') . '/' . $file_name);
     $send = true;
     if (!isset($file_dropbox['error'])) {
         if ($file_dropbox['bytes'] != filesize($fromFile)) {
             $delete_file = $dropbox->deleteFile($folder_project . $context->get('folder') . '/' . $file_name);
             if (isset($delete_file['error'])) {
                 $context->setError(langWPADM::get('Dropbox returned an error during file sending: ', false) . '"' . $delete_file['text'] . '"');
                 return false;
             }
             $data_error_command = WPAdm_Running::getCommandResultData('errors_sending');
             if (isset($data_command[$fromFile])) {
                 $data_error_command[$fromFile]['count'] += 1;
             } else {
                 $data_error_command[$fromFile] = array();
                 $data_error_command[$fromFile]['count'] = 1;
             }
             WPAdm_Running::setCommandResultData('errors_sending', $data_error_command);
         } else {
             $send = false;
         }
     }
     if ($local) {
         $data_command = WPAdm_Running::getCommandResultData('command_dropbox');
         if (empty($data_command) || !in_array($fromFile, $data_command)) {
             if ($send) {
                 $res = $dropbox->uploadFile($fromFile, $toFile, true);
             } else {
                 $this->saveDataCommand($fromFile);
             }
         }
     } else {
         $res = $dropbox->uploadFile($fromFile, $toFile, true);
     }
     if (isset($res['error']) && isset($res['text']) && $res['error'] == 1) {
         $context->setError(langWPADM::get('Dropbox returned an error during file sending: ', false) . '"' . $res['text'] . '"');
         return false;
     }
     if (isset($res['size']) && isset($res['client_mtime'])) {
         WPAdm_Core::log(langWPADM::get('File upload: ', false) . basename($files) . langWPADM::get(' size: ', false) . $res['size']);
         $this->saveDataCommand($fromFile);
     }
     return true;
 }
开发者ID:derwegas,项目名称:strubbelkinder,代码行数:68,代码来源:class-wpadm-command-send-to-dropbox.php


注:本文中的dropbox::deleteFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。