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


PHP BackWPup类代码示例

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


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

示例1: option_defaults

 /**
  * @return array
  */
 public function option_defaults()
 {
     $upload_dir = wp_upload_dir();
     $backups_dir = trailingslashit(str_replace('\\', '/', $upload_dir['basedir'])) . 'backwpup-' . BackWPup::get_plugin_data('hash') . '-backups/';
     $content_path = trailingslashit(str_replace('\\', '/', WP_CONTENT_DIR));
     $backups_dir = str_replace($content_path, '', $backups_dir);
     return array('maxbackups' => 15, 'backupdir' => $backups_dir, 'backupsyncnodelete' => TRUE);
 }
开发者ID:demochko-ol,项目名称:hezy,代码行数:11,代码来源:class-destination-folder.php

示例2: admin_print_scripts

 /**
  *
  */
 public function admin_print_scripts()
 {
     if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
         wp_enqueue_script('backwpupjobtypefile', BackWPup::get_plugin_data('URL') . '/assets/js/page_edit_jobtype_file.js', array('jquery'), time(), TRUE);
     } else {
         wp_enqueue_script('backwpupjobtypefile', BackWPup::get_plugin_data('URL') . '/assets/js/page_edit_jobtype_file.min.js', array('jquery'), BackWPup::get_plugin_data('Version'), TRUE);
     }
 }
开发者ID:mahassan,项目名称:shellneverknow,代码行数:11,代码来源:class-jobtype-file.php

示例3: abort

 /**
  *  Abort a working BackWPup Job
  *
  *  @synopsis abort
  */
 public function abort($args, $assoc_args)
 {
     if (file_exists(BackWPup::get_plugin_data('running_file'))) {
         WP_CLI::error(__('Nothing to abort!', 'backwpup'));
     }
     //abort
     BackWPup_Job::user_abort();
     WP_CLI::success(__('Job will be terminated.', 'backwpup'));
 }
开发者ID:isrealconsulting,项目名称:site,代码行数:14,代码来源:class-wp-cli.php

示例4: check_cleanup

 /**
  * Check Jobs worked and Cleanup logs and so on
  */
 public static function check_cleanup()
 {
     $job_object = BackWPup_Job::get_working_data();
     $log_folder = get_site_option('backwpup_cfg_logfolder');
     $log_folder = BackWPup_File::get_absolute_path($log_folder);
     // check aborted jobs for longer than a tow hours, abort them courtly and send mail
     if (is_object($job_object) && !empty($job_object->logfile)) {
         $not_worked_time = microtime(TRUE) - $job_object->timestamp_last_update;
         if ($not_worked_time > 3600) {
             $job_object->log(E_USER_ERROR, __('Aborted, because no progress for one hour!', 'backwpup'), __FILE__, __LINE__);
             unlink(BackWPup::get_plugin_data('running_file'));
             $job_object->update_working_data();
         }
     }
     //Compress not compressed logs
     if (is_readable($log_folder) && function_exists('gzopen') && get_site_option('backwpup_cfg_gzlogs') && !is_object($job_object)) {
         //Compress old not compressed logs
         if ($dir = opendir($log_folder)) {
             $jobids = BackWPup_Option::get_job_ids();
             while (FALSE !== ($file = readdir($dir))) {
                 if (is_writeable($log_folder . $file) && '.html' == substr($file, -5)) {
                     $compress = new BackWPup_Create_Archive($log_folder . $file . '.gz');
                     if ($compress->add_file($log_folder . $file)) {
                         unlink($log_folder . $file);
                         //change last logfile in jobs
                         foreach ($jobids as $jobid) {
                             $job_logfile = BackWPup_Option::get($jobid, 'logfile');
                             if (!empty($job_logfile) && $job_logfile === $log_folder . $file) {
                                 BackWPup_Option::update($jobid, 'logfile', $log_folder . $file . '.gz');
                             }
                         }
                     }
                     unset($compress);
                 }
             }
             closedir($dir);
         }
     }
     //Jobs cleanings
     if (!$job_object) {
         //remove restart cron
         wp_clear_scheduled_hook('backwpup_cron', array('id' => 'restart'));
         //temp cleanup
         BackWPup_Job::clean_temp_folder();
     }
     //check scheduling jobs that not found will removed because there are single scheduled
     $activejobs = BackWPup_Option::get_job_ids('activetype', 'wpcron');
     foreach ($activejobs as $jobid) {
         $cron_next = wp_next_scheduled('backwpup_cron', array('id' => $jobid));
         if (!$cron_next || $cron_next < time()) {
             wp_unschedule_event($cron_next, 'backwpup_cron', array('id' => $jobid));
             $cron_next = BackWPup_Cron::cron_next(BackWPup_Option::get($jobid, 'cron'));
             wp_schedule_single_event($cron_next, 'backwpup_cron', array('id' => $jobid));
         }
     }
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:59,代码来源:class-cron.php

示例5: __construct

 /**
  *
  */
 public function __construct()
 {
     $this->info['ID'] = 'DBCHECK';
     $this->info['name'] = __('DB Check', 'backwpup');
     $this->info['description'] = __('Check database tables', 'backwpup');
     $this->info['URI'] = __('http://backwpup.com', 'backwpup');
     $this->info['author'] = 'Inpsyde GmbH';
     $this->info['authorURI'] = __('http://inpsyde.com', 'backwpup');
     $this->info['version'] = BackWPup::get_plugin_data('Version');
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:13,代码来源:class-jobtype-dbcheck.php

示例6: __construct

 /**
  *
  */
 public function __construct()
 {
     $this->info['ID'] = 'DBCHECK';
     $this->info['name'] = __('DB Check', 'backwpup');
     $this->info['description'] = __('Check database tables', 'backwpup');
     $this->info['URI'] = translate(BackWPup::get_plugin_data('PluginURI'), 'backwpup');
     $this->info['author'] = BackWPup::get_plugin_data('Author');
     $this->info['authorURI'] = translate(BackWPup::get_plugin_data('AuthorURI'), 'backwpup');
     $this->info['version'] = BackWPup::get_plugin_data('Version');
 }
开发者ID:mahassan,项目名称:shellneverknow,代码行数:13,代码来源:class-jobtype-dbcheck.php

示例7: __construct

 public function __construct()
 {
     $this->info['ID'] = 'WPWIDGET';
     $this->info['name'] = __('Widget', 'backwpup-widget');
     $this->info['description'] = __('Widget list', 'backwpup-widget');
     $this->info['URI'] = translate(BackWPup::get_plugin_data('WidgetURI'), 'backwpup-widget');
     $this->info['author'] = BackWPup::get_plugin_data('Author');
     $this->info['authorURI'] = translate(BackWPup::get_plugin_data('AuthorURI'), 'backwpup-widget');
     $this->info['version'] = BackWPup::get_plugin_data('Version');
 }
开发者ID:rufas-hajdu,项目名称:backwpup-widget,代码行数:10,代码来源:class-jobtype-wpwidget.php

示例8: help

 /**
  *
  */
 public static function help()
 {
     if (method_exists(get_current_screen(), 'add_help_tab')) {
         get_current_screen()->add_help_tab(array('id' => 'plugininfo', 'title' => __('Plugin Info', 'backwpup'), 'content' => '<p> ' . str_replace('\\"', '"', sprintf(_x('%1$s version %2$s. A project by <a href="http://inpsyde.com">Inpsyde GmbH</a>.', 'Plugin name and link; Plugin Version', 'backwpup'), '<a href="' . esc_attr__('http://backwpup.com', 'backwpup') . '">' . BackWPup::get_plugin_data('Name') . '</a>', BackWPup::get_plugin_data('Version'))) . '</p>' . '<p>' . esc_html__('BackWPup comes with ABSOLUTELY NO WARRANTY. This is a free software, and you are welcome to redistribute it under certain conditions.', 'backwpup') . '</p>'));
         $text_help_sidebar = '<p><strong>' . __('For more information:', 'backwpup') . '</strong></p>';
         $text_help_sidebar .= '<p><a href="' . esc_attr__('http://backwpup.com', 'backwpup') . '">' . BackWPup::get_plugin_data('Name') . '</a></p>';
         $text_help_sidebar .= '<p><a href="http://wordpress.org/extend/plugins/backwpup/">' . esc_html__('Plugin on wordpress.org', 'backwpup') . '</a></p>';
         $text_help_sidebar .= '<p><a href="' . esc_attr__('http://docs.backwpup.com', 'backwpup') . '">' . esc_html__('Manual', 'backwpup') . '</a></p>';
         get_current_screen()->set_help_sidebar($text_help_sidebar);
     }
 }
开发者ID:skinnard,项目名称:FTL-2,代码行数:14,代码来源:class-help.php

示例9: help

 /**
  *
  */
 public static function help()
 {
     if (method_exists(get_current_screen(), 'add_help_tab')) {
         get_current_screen()->add_help_tab(array('id' => 'plugininfo', 'title' => __('Plugin Info', 'backwpup'), 'content' => '<p> ' . str_replace('\\"', '"', sprintf(_x('%1$s version %2$s. A project by <a href="http://inpsyde.com">Inpsyde GmbH</a>.', 'Plugin name and link; Plugin Version', 'backwpup'), '<a href="' . translate(BackWPup::get_plugin_data('PluginURI'), 'backwpup') . '">' . BackWPup::get_plugin_data('Name') . '</a>', BackWPup::get_plugin_data('Version'))) . '</p>' . '<p>' . __('BackWPup comes with ABSOLUTELY NO WARRANTY. This is a free software, and you are welcome to redistribute it under certain conditions.', 'backwpup') . '</p>'));
         $text_help_sidebar = '<p><strong>' . __('For more information:', 'backwpup') . '</strong></p>';
         $text_help_sidebar .= '<p><a href="' . translate(BackWPup::get_plugin_data('PluginURI'), 'backwpup') . '">' . BackWPup::get_plugin_data('Name') . '</a></p>';
         $text_help_sidebar .= '<p><a href="http://wordpress.org/extend/plugins/backwpup/">' . __('Plugin on wordpress.org', 'backwpup') . '</a></p>';
         $text_help_sidebar .= '<p><a href="' . __('https://marketpress.com/news/', 'backwpup') . '">' . __('News', 'backwpup') . '</a></p>';
         if (class_exists('BackWPup_Pro', FALSE)) {
             $text_help_sidebar .= '<p><a href="' . __('https://marketpress.com/support/forum/plugins/backwpup-pro/', 'backwpup') . '">' . __('Pro Support', 'backwpup') . '</a></p>';
         } else {
             $text_help_sidebar .= '<p><a href="' . __('http://wordpress.org/support/plugin/backwpup/', 'backwpup') . '">' . __('Support', 'backwpup') . '</a></p>';
         }
         $text_help_sidebar .= '<p><a href="' . __('https://marketpress.com/documentation/backwpup-pro/', 'backwpup') . '">' . __('Manual', 'backwpup') . '</a></p>';
         get_current_screen()->set_help_sidebar($text_help_sidebar);
     }
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:20,代码来源:class-help.php

示例10: adminbar

 /**
  * @global $wp_admin_bar WP_Admin_Bar
  */
 public function adminbar()
 {
     global $wp_admin_bar;
     /* @var WP_Admin_Bar $wp_admin_bar */
     $menu_title = '<span class="ab-icon"></span><span class="ab-label">' . BackWPup::get_plugin_data('name') . '</span>';
     $menu_herf = network_admin_url('admin.php') . '?page=backwpup';
     if (file_exists(BackWPup::get_plugin_data('running_file')) && current_user_can('backwpup_jobs_start')) {
         $menu_title = '<span class="ab-icon"></span><span class="ab-label">' . BackWPup::get_plugin_data('name') . ' <span id="backwpup-adminbar-running">' . __('running', 'backwpup') . '</span></span>';
         $menu_herf = network_admin_url('admin.php') . '?page=backwpupjobs';
     }
     if (current_user_can('backwpup')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup', 'title' => $menu_title, 'href' => $menu_herf, 'meta' => array('title' => BackWPup::get_plugin_data('name'))));
     }
     if (file_exists(BackWPup::get_plugin_data('running_file')) && current_user_can('backwpup_jobs_start')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_working', 'parent' => 'backwpup_jobs', 'title' => __('Now Running', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupjobs'));
         $wp_admin_bar->add_menu(array('id' => 'backwpup_working_abort', 'parent' => 'backwpup_working', 'title' => __('Abort!', 'backwpup'), 'href' => wp_nonce_url(network_admin_url('admin.php') . '?page=backwpup&action=abort', 'abort-job')));
     }
     if (current_user_can('backwpup_jobs')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_jobs', 'parent' => 'backwpup', 'title' => __('Jobs', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupjobs'));
     }
     if (current_user_can('backwpup_jobs_edit')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_new', 'parent' => 'backwpup_jobs', 'title' => __('Add new', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupeditjob&tab=job'));
     }
     if (current_user_can('backwpup_logs')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_logs', 'parent' => 'backwpup', 'title' => __('Logs', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpuplogs'));
     }
     if (current_user_can('backwpup_backups')) {
         $wp_admin_bar->add_menu(array('id' => 'backwpup_backups', 'parent' => 'backwpup', 'title' => __('Backups', 'backwpup'), 'href' => network_admin_url('admin.php') . '?page=backwpupbackups'));
     }
     //add jobs
     $jobs = (array) BackWPup_Option::get_job_ids();
     foreach ($jobs as $jobid) {
         if (current_user_can('backwpup_jobs_edit')) {
             $name = BackWPup_Option::get($jobid, 'name');
             $wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_' . $jobid, 'parent' => 'backwpup_jobs', 'title' => $name, 'href' => wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&tab=job&jobid=' . $jobid, 'edit-job')));
         }
         if (current_user_can('backwpup_jobs_start')) {
             $url = BackWPup_Job::get_jobrun_url('runnowlink', $jobid);
             $wp_admin_bar->add_menu(array('id' => 'backwpup_jobs_runnow_' . $jobid, 'parent' => 'backwpup_jobs_' . $jobid, 'title' => __('Run Now', 'backwpup'), 'href' => $url['url']));
         }
     }
 }
开发者ID:leotaillard,项目名称:btws2016,代码行数:45,代码来源:class-adminbar.php

示例11: request

 /**
  * @param        $url
  * @param array  $args
  * @param string $method
  * @param string $data
  * @param bool   $echo
  *
  * @throws BackWPup_Destination_Dropbox_API_Exception
  * @internal param null $file
  * @return array|mixed|string
  */
 private function request($url, $args = array(), $method = 'GET', $data = '', $echo = FALSE)
 {
     /* Header*/
     $headers[] = 'Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="' . $this->oauth_app_key . '", oauth_token="' . $this->oauth_token . '", oauth_signature="' . $this->oauth_app_secret . '&' . $this->oauth_token_secret . '"';
     $headers[] = 'Expect:';
     /* Build cURL Request */
     $ch = curl_init();
     if ($method == 'POST') {
         curl_setopt($ch, CURLOPT_POST, TRUE);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
         curl_setopt($ch, CURLOPT_URL, $url);
     } elseif ($method == 'PUT') {
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         $headers[] = 'Content-Type: application/octet-stream';
         $args = is_array($args) ? '?' . http_build_query($args, '', '&') : $args;
         curl_setopt($ch, CURLOPT_URL, $url . $args);
     } else {
         curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
         $args = is_array($args) ? '?' . http_build_query($args, '', '&') : $args;
         curl_setopt($ch, CURLOPT_URL, $url . $args);
     }
     curl_setopt($ch, CURLOPT_USERAGENT, BackWPup::get_plugin_data('User-Agent'));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
     if (BackWPup::get_plugin_data('cacert')) {
         curl_setopt($ch, CURLOPT_SSLVERSION, 3);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
         curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'ECDHE-RSA-AES256-GCM-SHA384:' . 'ECDHE-RSA-AES128-GCM-SHA256:' . 'ECDHE-RSA-AES256-SHA384:' . 'ECDHE-RSA-AES128-SHA256:' . 'ECDHE-RSA-AES256-SHA:' . 'ECDHE-RSA-AES128-SHA:' . 'ECDHE-RSA-RC4-SHA:' . 'DHE-RSA-AES256-GCM-SHA384:' . 'DHE-RSA-AES128-GCM-SHA256:' . 'DHE-RSA-AES256-SHA256:' . 'DHE-RSA-AES128-SHA256:' . 'DHE-RSA-AES256-SHA:' . 'DHE-RSA-AES128-SHA:' . 'AES256-GCM-SHA384:' . 'AES128-GCM-SHA256:' . 'AES256-SHA256:' . 'AES128-SHA256:' . 'AES256-SHA:' . 'AES128-SHA');
         if (defined('CURLOPT_PROTOCOLS')) {
             curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
         }
         if (defined('CURLOPT_REDIR_PROTOCOLS')) {
             curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
         }
         curl_setopt($ch, CURLOPT_CAINFO, BackWPup::get_plugin_data('cacert'));
         curl_setopt($ch, CURLOPT_CAPATH, dirname(BackWPup::get_plugin_data('cacert')));
     } else {
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     }
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     $output = '';
     if ($echo) {
         echo curl_exec($ch);
     } else {
         curl_setopt($ch, CURLOPT_HEADER, TRUE);
         if (0 == curl_errno($ch)) {
             $responce = explode("\r\n\r\n", curl_exec($ch), 2);
             if (!empty($responce[1])) {
                 $output = json_decode($responce[1], TRUE);
             }
         }
     }
     $status = curl_getinfo($ch);
     if (isset($datafilefd) && is_resource($datafilefd)) {
         fclose($datafilefd);
     }
     if ($status['http_code'] == 503) {
         $wait = 0;
         if (preg_match("/retry-after:(.*?)\r/i", $responce[0], $matches)) {
             $wait = trim($matches[1]);
         }
         //only wait if we get a retry-after header.
         if (!empty($wait)) {
             trigger_error(sprintf('(503) Your app is making too many requests and is being rate limited. Error 503 can be triggered on a per-app or per-user basis. Wait for %d seconds.', $wait), E_USER_WARNING);
             sleep($wait);
         } else {
             trigger_error('(503) Service unavailable. Retrying.', E_USER_WARNING);
         }
         //redo request
         return $this->request($url, $args, $method, $data, $echo);
     } elseif ($status['http_code'] == 400 && $method == 'PUT') {
         //correct offset on chunk uploads
         trigger_error('(' . $status['http_code'] . ') False offset will corrected', E_USER_NOTICE);
         return $output;
     } elseif ($status['http_code'] == 404 && !empty($output['error'])) {
         trigger_error('(' . $status['http_code'] . ') ' . $output['error'], E_USER_WARNING);
         return FALSE;
     } elseif (isset($output['error']) || $status['http_code'] >= 300 || $status['http_code'] < 200 || curl_errno($ch) > 0) {
         if (isset($output['error']) && is_string($output['error'])) {
             $message = '(' . $status['http_code'] . ') ' . $output['error'];
         } elseif (isset($output['error']['hash']) && $output['error']['hash'] != '') {
             $message = (string) '(' . $status['http_code'] . ') ' . $output['error']['hash'];
         } elseif (0 != curl_errno($ch)) {
             $message = '(' . curl_errno($ch) . ') ' . curl_error($ch);
         } elseif ($status['http_code'] == 304) {
             $message = '(304) Folder contents have not changed (relies on hash parameter).';
         } elseif ($status['http_code'] == 400) {
             $message = '(400) Bad input parameter: ' . strip_tags($responce[1]);
         } elseif ($status['http_code'] == 401) {
//.........这里部分代码省略.........
开发者ID:isrealconsulting,项目名称:site,代码行数:101,代码来源:class-destination-dropbox.php

示例12: page

    /**
     *
     */
    public static function page()
    {
        if (!empty($_GET['jobid'])) {
            $jobid = (int) $_GET['jobid'];
        } else {
            //generate jobid if not exists
            $newjobid = BackWPup_Option::get_job_ids();
            sort($newjobid);
            $jobid = end($newjobid) + 1;
        }
        $destinations = BackWPup::get_registered_destinations();
        $job_types = BackWPup::get_job_types();
        ?>
    <div class="wrap" id="backwpup-page">
		<?php 
        echo '<h2><span id="backwpup-page-icon">&nbsp;</span>' . sprintf(__('%1$s Job: %2$s', 'backwpup'), BackWPup::get_plugin_data('name'), '<span id="h2jobtitle">' . esc_html(BackWPup_Option::get($jobid, 'name')) . '</span>') . '</h2>';
        //default tabs
        $tabs = array('job' => array('name' => __('General', 'backwpup'), 'display' => TRUE), 'cron' => array('name' => __('Schedule', 'backwpup'), 'display' => TRUE));
        //add jobtypes to tabs
        $job_job_types = BackWPup_Option::get($jobid, 'type');
        foreach ($job_types as $typeid => $typeclass) {
            $tabid = 'jobtype-' . strtolower($typeid);
            $tabs[$tabid]['name'] = $typeclass->info['name'];
            $tabs[$tabid]['display'] = TRUE;
            if (!in_array($typeid, $job_job_types)) {
                $tabs[$tabid]['display'] = FALSE;
            }
        }
        //add destinations to tabs
        $jobdests = BackWPup_Option::get($jobid, 'destinations');
        foreach ($destinations as $destid => $dest) {
            $tabid = 'dest-' . strtolower($destid);
            $tabs[$tabid]['name'] = sprintf(__('To: %s', 'backwpup'), $dest['info']['name']);
            $tabs[$tabid]['display'] = TRUE;
            if (!in_array($destid, $jobdests)) {
                $tabs[$tabid]['display'] = FALSE;
            }
        }
        //display tabs
        echo '<h2 class="nav-tab-wrapper">';
        foreach ($tabs as $id => $tab) {
            $addclass = '';
            if ($id == $_GET['tab']) {
                $addclass = ' nav-tab-active';
            }
            $display = '';
            if (!$tab['display']) {
                $display = ' style="display:none;"';
            }
            echo '<a href="' . wp_nonce_url(network_admin_url('admin.php') . '?page=backwpupeditjob&tab=' . $id . '&jobid=' . $jobid, 'edit-job') . '" class="nav-tab' . $addclass . '" id="tab-' . $id . '" data-nexttab="' . $id . '" ' . $display . '>' . $tab['name'] . '</a>';
        }
        echo '</h2>';
        //display messages
        BackWPup_Admin::display_messages();
        echo '<form name="editjob" id="editjob" method="post" action="' . admin_url('admin-post.php') . '">';
        echo '<input type="hidden" id="jobid" name="jobid" value="' . $jobid . '" />';
        echo '<input type="hidden" name="tab" value="' . $_GET['tab'] . '" />';
        echo '<input type="hidden" name="nexttab" value="' . $_GET['tab'] . '" />';
        echo '<input type="hidden" name="page" value="backwpupeditjob" />';
        echo '<input type="hidden" name="action" value="backwpup" />';
        echo '<input type="hidden" name="anchor" value="" />';
        wp_nonce_field('backwpupeditjob_page');
        wp_nonce_field('backwpup_ajax_nonce', 'backwpupajaxnonce', FALSE);
        switch ($_GET['tab']) {
            case 'job':
                echo '<div class="table" id="info-tab-job">';
                ?>
				<h3 class="title"><?php 
                _e('Job Name', 'backwpup');
                ?>
</h3>
				<p></p>
				<table class="form-table">
					<tr>
						<th scope="row"><label for="name"><?php 
                _e('Please name this job.', 'backwpup');
                ?>
</label></th>
						<td>
							<input name="name" type="text" id="name" data-empty="<?php 
                _e('New Job', 'backwpup');
                ?>
"
								   value="<?php 
                echo BackWPup_Option::get($jobid, 'name');
                ?>
" class="regular-text" />
						</td>
					</tr>
				</table>

				<h3 class="title"><?php 
                _e('Job Tasks', 'backwpup');
                ?>
</h3>
				<p></p>
				<table class="form-table">
//.........这里部分代码省略.........
开发者ID:byadrenaline,项目名称:laseravalon_wp,代码行数:101,代码来源:class-page-editjob.php

示例13: request

 /**
  * @param        $url
  * @param array $args
  * @param string $method
  * @param string $data
  * @param bool $echo
  *
  * @throws BackWPup_Destination_Dropbox_API_Exception
  * @internal param null $file
  * @return array|mixed|string
  */
 private function request($url, $args = array(), $method = 'GET', $data = '', $echo = false)
 {
     /* Header*/
     // oAuth 2
     if (!empty($this->oauth_token['access_token']) && !empty($this->oauth_token['token_type']) && strtolower($this->oauth_token['token_type']) == 'bearer') {
         $headers[] = 'Authorization: Bearer ' . $this->oauth_token['access_token'];
     } elseif (!empty($this->oauth_token['access_token']) && !empty($this->oauth_token['oauth_token_secret'])) {
         $headers[] = 'Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="' . $this->oauth_app_key . '", oauth_token="' . $this->oauth_token['access_token'] . '", oauth_signature="' . $this->oauth_app_secret . '&' . $this->oauth_token['oauth_token_secret'] . '"';
     }
     $headers[] = 'Expect:';
     /* Build cURL Request */
     $ch = curl_init();
     if ($method == 'POST') {
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
         curl_setopt($ch, CURLOPT_URL, $url);
     } elseif ($method == 'PUT') {
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
         curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
         $headers[] = 'Content-Type: application/octet-stream';
         $args = is_array($args) ? '?' . http_build_query($args, '', '&') : $args;
         curl_setopt($ch, CURLOPT_URL, $url . $args);
     } else {
         curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
         $args = is_array($args) ? '?' . http_build_query($args, '', '&') : $args;
         curl_setopt($ch, CURLOPT_URL, $url . $args);
     }
     curl_setopt($ch, CURLOPT_USERAGENT, BackWPup::get_plugin_data('User-Agent'));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     if (BackWPup::get_plugin_data('cacert')) {
         curl_setopt($ch, CURLOPT_SSLVERSION, 1);
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
         $curl_version = curl_version();
         if (strstr($curl_version['ssl_version'], 'NSS/') === false) {
             curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'ECDHE-RSA-AES256-GCM-SHA384:' . 'ECDHE-RSA-AES128-GCM-SHA256:' . 'ECDHE-RSA-AES256-SHA384:' . 'ECDHE-RSA-AES128-SHA256:' . 'ECDHE-RSA-AES256-SHA:' . 'ECDHE-RSA-AES128-SHA:' . 'ECDHE-RSA-RC4-SHA:' . 'DHE-RSA-AES256-GCM-SHA384:' . 'DHE-RSA-AES128-GCM-SHA256:' . 'DHE-RSA-AES256-SHA256:' . 'DHE-RSA-AES128-SHA256:' . 'DHE-RSA-AES256-SHA:' . 'DHE-RSA-AES128-SHA:' . 'AES256-GCM-SHA384:' . 'AES128-GCM-SHA256:' . 'AES256-SHA256:' . 'AES128-SHA256:' . 'AES256-SHA:' . 'AES128-SHA');
         }
         if (defined('CURLOPT_PROTOCOLS')) {
             curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
         }
         if (defined('CURLOPT_REDIR_PROTOCOLS')) {
             curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
         }
         curl_setopt($ch, CURLOPT_CAINFO, BackWPup::get_plugin_data('cacert'));
         curl_setopt($ch, CURLOPT_CAPATH, dirname(BackWPup::get_plugin_data('cacert')));
     } else {
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     }
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     $output = '';
     if ($echo) {
         echo curl_exec($ch);
     } else {
         curl_setopt($ch, CURLOPT_HEADER, true);
         if (0 == curl_errno($ch)) {
             $responce = explode("\r\n\r\n", curl_exec($ch), 2);
             if (!empty($responce[1])) {
                 $output = json_decode($responce[1], true);
             }
         }
     }
     $status = curl_getinfo($ch);
     if ($status['http_code'] == 503) {
         $wait = 0;
         if (preg_match("/retry-after:(.*?)\r/i", $responce[0], $matches)) {
             $wait = trim($matches[1]);
         }
         //only wait if we get a retry-after header.
         if (!empty($wait)) {
             trigger_error(sprintf('(503) Your app is making too many requests and is being rate limited. Error 503 can be triggered on a per-app or per-user basis. Wait for %d seconds.', $wait), E_USER_WARNING);
             sleep($wait);
         } else {
             throw new BackWPup_Destination_Dropbox_API_Exception('(503) This indicates a transient server error.');
         }
         //redo request
         return $this->request($url, $args, $method, $data, $echo);
     } elseif ($status['http_code'] === 400 && $method === 'PUT' && strstr($url, '/chunked_upload')) {
         //correct offset on chunk uploads
         trigger_error('(' . $status['http_code'] . ') False offset will corrected', E_USER_NOTICE);
         return $output;
     } elseif ($status['http_code'] === 404 && !empty($output['error'])) {
         trigger_error('(' . $status['http_code'] . ') ' . $output['error'], E_USER_WARNING);
         return false;
     } elseif (isset($output['error']) || $status['http_code'] >= 300 || $status['http_code'] < 200 || curl_errno($ch) > 0) {
         if (isset($output['error']) && is_string($output['error'])) {
             $args = is_array($args) ? '?' . http_build_query($args, '', '&') : $args;
             $message = '(' . $status['http_code'] . ') ' . $output['error'] . ' ' . $url . $args;
         } elseif (isset($output['error']['hash']) && $output['error']['hash'] != '') {
             $message = (string) '(' . $status['http_code'] . ') ' . $output['error']['hash'] . ' ' . $url . $args;
         } elseif (0 != curl_errno($ch)) {
//.........这里部分代码省略.........
开发者ID:skinnard,项目名称:FTL-2,代码行数:101,代码来源:class-destination-dropbox.php

示例14: create_account

 /**
  * @param $email
  * @param $password
  * @throws BackWPup_Destination_SugarSync_API_Exception
  */
 public function create_account($email, $password)
 {
     $auth = '<?xml version="1.0" encoding="UTF-8" ?>';
     $auth .= '<user>';
     $auth .= '<email>' . mb_convert_encoding($email, 'UTF-8', $this->encoding) . '</email>';
     $auth .= '<password>' . mb_convert_encoding($password, 'UTF-8', $this->encoding) . '</password>';
     $auth .= '<accessKeyId>' . get_site_option('backwpup_cfg_sugarsynckey', base64_decode("TlRBek1EY3lOakV6TkRrMk1URXhNemM0TWpJ")) . '</accessKeyId>';
     $auth .= '<privateAccessKey>' . BackWPup_Encryption::decrypt(get_site_option('backwpup_cfg_sugarsyncsecret', base64_decode("TkRFd01UazRNVEpqTW1Ga05EaG1NR0k1TVRFNFpqa3lPR1V6WlRVMk1tTQ=="))) . '</privateAccessKey>';
     $auth .= '</user>';
     // init
     $curl = curl_init();
     //set options
     curl_setopt($curl, CURLOPT_URL, 'https://provisioning-api.sugarsync.com/users');
     curl_setopt($curl, CURLOPT_USERAGENT, BackWPup::get_plugin_data('User-Agent'));
     if (ini_get('open_basedir') == '') {
         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, TRUE);
     }
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
     if (BackWPup::get_plugin_data('cacert')) {
         curl_setopt($curl, CURLOPT_SSLVERSION, 1);
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
         curl_setopt($curl, CURLOPT_CAINFO, BackWPup::get_plugin_data('cacert'));
         curl_setopt($curl, CURLOPT_CAPATH, dirname(BackWPup::get_plugin_data('cacert')));
     } else {
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
     }
     curl_setopt($curl, CURLOPT_HEADER, TRUE);
     curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/xml; charset=UTF-8', 'Content-Length: ' . strlen($auth)));
     curl_setopt($curl, CURLOPT_POSTFIELDS, $auth);
     curl_setopt($curl, CURLOPT_POST, TRUE);
     // execute
     $response = curl_exec($curl);
     $curlgetinfo = curl_getinfo($curl);
     // fetch curl errors
     if (curl_errno($curl) != 0) {
         throw new BackWPup_Destination_SugarSync_API_Exception('cUrl Error: ' . curl_error($curl));
     }
     curl_close($curl);
     if ($curlgetinfo['http_code'] == 201) {
         throw new BackWPup_Destination_SugarSync_API_Exception('Account created.');
     } else {
         if ($curlgetinfo['http_code'] == 400) {
             throw new BackWPup_Destination_SugarSync_API_Exception('Http Error: ' . $curlgetinfo['http_code'] . ' ' . substr($response, $curlgetinfo['header_size']));
         } elseif ($curlgetinfo['http_code'] == 401) {
             throw new BackWPup_Destination_SugarSync_API_Exception('Http Error: ' . $curlgetinfo['http_code'] . ' Developer credentials cannot be verified. Either a developer with the specified accessKeyId does not exist or the privateKeyID does not match an assigned accessKeyId.');
         } elseif ($curlgetinfo['http_code'] == 403) {
             throw new BackWPup_Destination_SugarSync_API_Exception('Http Error: ' . $curlgetinfo['http_code'] . ' ' . substr($response, $curlgetinfo['header_size']));
         } elseif ($curlgetinfo['http_code'] == 503) {
             throw new BackWPup_Destination_SugarSync_API_Exception('Http Error: ' . $curlgetinfo['http_code'] . ' ' . substr($response, $curlgetinfo['header_size']));
         } else {
             throw new BackWPup_Destination_SugarSync_API_Exception('Http Error: ' . $curlgetinfo['http_code']);
         }
     }
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:59,代码来源:class-destination-sugarsync.php

示例15: get_wizards

 /**
  * Gets a array of instances from Wizards
  *
  * @return array BackWPup_Pro_Wizards
  */
 public static function get_wizards()
 {
     if (!empty(self::$wizards)) {
         return self::$wizards;
     }
     self::$wizards = apply_filters('backwpup_pro_wizards', self::$wizards);
     //remove wizards can't load
     foreach (self::$wizards as $key => $wizard) {
         if (empty($wizard) || !is_object($wizard)) {
             unset(self::$wizards[$key]);
         }
     }
     return self::$wizards;
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:19,代码来源:backwpup.php


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