• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wp_ob_end_flush_all函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: process


//.........这里部分代码省略.........
                                libxml_use_internal_errors($old);
                                $xpath = new DOMXPath($dom);
                                if ($elements = @$xpath->query($import->xpath) and $elements->length) {
                                    $records_count += $elements->length;
                                    $chunk_records_count += $elements->length;
                                    $feed .= $xml;
                                }
                            }
                            if ($chunk_records_count == PMXI_Plugin::getInstance()->getOption('large_feed_limit') or $records_count == $import->count) {
                                $feed .= "</pmxi_records>";
                                $chunk_file_path = wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::TEMP_DIRECTORY) . DIRECTORY_SEPARATOR . "pmxi_chunk_" . count($chunk_files) . "_" . basename($path);
                                file_put_contents($chunk_file_path, $feed);
                                $chunk_files[] = $chunk_file_path;
                                $chunk_records_count = 0;
                                $feed = "<?xml version=\"1.0\" encoding=\"" . $import->options['encoding'] . "\"?>" . "\n" . "<pmxi_records>";
                            }
                        }
                    }
                    PMXI_Plugin::$session->set('local_paths', $chunk_files);
                }
            }
            PMXI_Plugin::$session->save_data();
            if ($log_storage) {
                $log_file = wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $history_log->id) . DIRECTORY_SEPARATOR . $history_log->id . '.html';
                if (PMXI_Plugin::$session->action != 'continue') {
                    if (file_exists($log_file)) {
                        wp_all_import_remove_source($log_file, false);
                    }
                    //@file_put_contents($log_file, sprintf(__('<p>Source path `%s`</p>', 'wp_all_import_plugin'), $import->path));
                }
            }
            $this->data['ajax_processing'] = "ajax" == $import->options['import_processing'] ? true : false;
            $this->render();
            wp_ob_end_flush_all();
            flush();
            @set_time_limit(0);
            $import_id = $input->get('id', 0);
            if ("ajax" == $import->options['import_processing'] and !$import_id) {
                PMXI_Plugin::$session->convertData($import->id);
                //die();
            }
        } elseif (empty($import->id)) {
            $import = new PMXI_Import_Record();
            $import_id = $input->get('id', PMXI_Plugin::$session->update_previous);
            $import->getById($import_id);
        }
        $ajax_processing = "ajax" == $import->options['import_processing'] ? true : false;
        if (PMXI_Plugin::is_ajax() and $ajax_processing and !check_ajax_referer('wp_all_import_secure', 'security', false)) {
            exit(__('Security check', 'wp_all_import_plugin'));
        }
        if ($ajax_processing) {
            $logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; flush();');
        } else {
            $logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; if ( "" != strip_tags(wp_all_import_strip_tags_content($m))) { PMXI_Plugin::$session->log .= "<p>".strip_tags(wp_all_import_strip_tags_content($m))."</p>"; flush(); }');
        }
        PMXI_Plugin::$session->set('start_time', empty(PMXI_Plugin::$session->start_time) ? time() : PMXI_Plugin::$session->start_time);
        wp_cache_flush();
        if (PMXI_Plugin::is_ajax() or !$ajax_processing) {
            $iteration_start_time = time();
            if ($log_storage) {
                $log_file = wp_all_import_secure_file($wp_uploads['basedir'] . DIRECTORY_SEPARATOR . PMXI_Plugin::LOGS_DIRECTORY, $history_log->id) . DIRECTORY_SEPARATOR . $history_log->id . '.html';
            }
            if ($ajax_processing) {
                // HTTP headers for no cache etc
                header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
                header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
开发者ID:hikaram,项目名称:wee,代码行数:67,代码来源:import.php


示例2: show_message

/**
 * Displays the given administration message.
 *
 * @since 2.1.0
 *
 * @param string|WP_Error $message
 */
function show_message($message)
{
    if (is_wp_error($message)) {
        if ($message->get_error_data() && is_string($message->get_error_data())) {
            $message = $message->get_error_message() . ': ' . $message->get_error_data();
        } else {
            $message = $message->get_error_message();
        }
    }
    echo "<p>{$message}</p>\n";
    wp_ob_end_flush_all();
    flush();
}
开发者ID:akalipetis,项目名称:WordPress,代码行数:20,代码来源:misc.php


示例3: gmedia_import_handler

function gmedia_import_handler()
{
    global $wpdb, $gmCore, $gmDB;
    ini_set('max_execution_time', 600);
    // HTTP headers for no cache etc
    send_nosniff_header();
    //send_origin_headers();
    nocache_headers();
    check_admin_referer('GmediaImport');
    if (!current_user_can('gmedia_import')) {
        wp_die(__('You do not have permission to upload files.'));
    }
    // 10 minutes execution time
    @set_time_limit(10 * 60);
    // fake upload time
    usleep(10);
    $import = $gmCore->_post('import');
    $terms = $gmCore->_post('terms', array());
    if (ob_get_level() == 0) {
        ob_start();
    }
    echo str_pad(' ', 4096) . PHP_EOL;
    wp_ob_end_flush_all();
    flush();
    ?>
    <html>
    <style type="text/css">
        * { margin:0; padding:0; }
        pre { display:block; }
        p { padding:10px 0; font-size:14px; }
        .ok { color:darkgreen; }
        .ko { color:darkred; }
    </style>
    <body>
    <?php 
    if ('import-folder' == $import || isset($_POST['import-folder'])) {
        $path = $gmCore->_post('path');
        echo '<h4 style="margin: 0 0 10px">' . __('Import Server Folder') . " `{$path}`:</h4>" . PHP_EOL;
        if ($path) {
            $path = trim(urldecode($path), '/');
            if (!empty($path)) {
                $fullpath = ABSPATH . trailingslashit($path);
                $files = glob($fullpath . '?*.?*', GLOB_NOSORT);
                if (!empty($files)) {
                    $allowed_ext = get_allowed_mime_types();
                    $allowed_ext = array_keys($allowed_ext);
                    $allowed_ext = implode('|', $allowed_ext);
                    $allowed_ext = explode('|', $allowed_ext);
                    if (GMEDIA_UPLOAD_FOLDER == basename(dirname(dirname($path))) || GMEDIA_UPLOAD_FOLDER == basename(dirname($path))) {
                        global $wpdb;
                        $gmedias = $wpdb->get_col("SELECT gmuid FROM {$wpdb->prefix}gmedia");
                        foreach ($files as $i => $filepath) {
                            $gmuid = basename($filepath);
                            if (in_array($gmuid, $gmedias)) {
                                $fileinfo = $gmCore->fileinfo($gmuid, false);
                                if (!('image' == $fileinfo['dirname'] && !is_file($fileinfo['filepath']))) {
                                    unset($files[$i]);
                                }
                            }
                        }
                        $move = false;
                        $exists = false;
                    } else {
                        $move = $gmCore->_post('delete_source');
                        $exists = $gmCore->_post('skip_exists', 0);
                    }
                    foreach ($files as $i => $filepath) {
                        $ext = pathinfo($filepath, PATHINFO_EXTENSION);
                        if (!in_array(strtolower($ext), $allowed_ext)) {
                            unset($files[$i]);
                        }
                    }
                    $gmCore->gmedia_import_files($files, $terms, $move, $exists);
                } else {
                    echo sprintf(__('Folder `%s` is empty', 'grand-media'), $path) . PHP_EOL;
                }
            } else {
                echo __('No folder chosen', 'grand-media') . PHP_EOL;
            }
        }
    } elseif ('import-flagallery' == $import || isset($_POST['import-flagallery'])) {
        echo '<h4 style="margin: 0 0 10px">' . __('Import from Flagallery plugin') . ":</h4>" . PHP_EOL;
        $gallery = $gmCore->_post('gallery');
        if (!empty($gallery)) {
            $album = !isset($terms['gmedia_album']) || empty($terms['gmedia_album']) ? false : true;
            foreach ($gallery as $gid) {
                $flag_gallery = $wpdb->get_row($wpdb->prepare("SELECT gid, path, title, galdesc FROM {$wpdb->prefix}flag_gallery WHERE gid = %d", $gid), ARRAY_A);
                if (empty($flag_gallery)) {
                    continue;
                }
                if (!$album) {
                    $terms['gmedia_album'] = $flag_gallery['title'];
                    if ($gmCore->is_digit($terms['gmedia_album'])) {
                        $terms['gmedia_album'] = 'a' . $terms['gmedia_album'];
                    }
                    if (!$gmDB->term_exists($terms['gmedia_album'], 'gmedia_album')) {
                        $term_id = $gmDB->insert_term($terms['gmedia_album'], 'gmedia_album', array('description' => htmlspecialchars_decode(stripslashes($flag_gallery['galdesc']))));
                    }
                }
                $path = ABSPATH . trailingslashit($flag_gallery['path']);
//.........这里部分代码省略.........
开发者ID:pasyuk,项目名称:grand-media,代码行数:101,代码来源:ajax.php


示例4: handle_imports

 function handle_imports()
 {
     if (!empty($_POST['files']) && !empty($_POST['cwd'])) {
         $files = array_map('stripslashes', $_POST['files']);
         $cwd = trailingslashit(stripslashes($_POST['cwd']));
         $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
         $import_date = isset($_REQUEST['import-date']) ? $_REQUEST['import-date'] : 'file';
         $import_to_gallery = isset($_POST['gallery']) && 'on' == $_POST['gallery'];
         if (!$import_to_gallery && !isset($_REQUEST['cwd'])) {
             $import_to_gallery = true;
         }
         // cwd should always be set, if it's not, and neither is gallery, this must be the first page load.
         if (!$import_to_gallery) {
             $post_id = 0;
         }
         flush();
         wp_ob_end_flush_all();
         foreach ((array) $files as $file) {
             $filename = $cwd . $file;
             $id = $this->handle_import_file($filename, $post_id, $import_date);
             if (is_wp_error($id)) {
                 echo '<div class="updated error"><p>' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'add-from-server'), esc_html($file), $id->get_error_message()) . '</p></div>';
             } else {
                 //increment the gallery count
                 if ($import_to_gallery) {
                     echo "<script type='text/javascript'>jQuery('#attachments-count').text(1 * jQuery('#attachments-count').text() + 1);</script>";
                 }
                 echo '<div class="updated"><p>' . sprintf(__('<em>%s</em> has been added to Media library', 'add-from-server'), esc_html($file)) . '</p></div>';
             }
             flush();
             wp_ob_end_flush_all();
         }
     }
 }
开发者ID:tmhaoge,项目名称:moped,代码行数:34,代码来源:class.add-from-server.php


示例5: flush

 /**
  * Flush
  * Use some aggressive flushing to make the "Building ..." dialog appear as soon as possible
  * on step 4.  This is based on ticket #18525
  * @link http://core.trac.wordpress.org/ticket/18525
  */
 public function flush()
 {
     if ('cli' === php_sapi_name()) {
         return;
     }
     wp_ob_end_flush_all();
     $buffer_string = '<!--' . str_repeat(chr(' '), 16384) . '-->';
     // 16 KB
     if (headers_sent()) {
         echo $buffer_string;
         flush();
     }
 }
开发者ID:fernflores0463,项目名称:RandolphTimesWeb,代码行数:19,代码来源:quick-setup.php


示例6: process

    /**
     * Import processing step (status console)
     */
    public function process($save_history = true)
    {
        $wp_uploads = wp_upload_dir();
        $import = $this->data['update_previous'];
        $logger = create_function('$m', 'echo "<div class=\\"progress-msg\\">$m</div>\\n"; if ( "" != strip_tags(pmxi_strip_tags_content($m)) and !empty(PMXI_Plugin::$session[\'pmxi_import\'][\'log\'])) { PMXI_Plugin::$session[\'pmxi_import\'][\'log\'] .= "<p>".strip_tags(pmxi_strip_tags_content($m))."</p>"; flush(); }');
        if (!PMXI_Plugin::is_ajax()) {
            $import->set((empty(PMXI_Plugin::$session->data['pmxi_import']['source']) ? array() : PMXI_Plugin::$session->data['pmxi_import']['source']) + array('xpath' => PMXI_Plugin::$session->data['pmxi_import']['xpath'], 'template' => PMXI_Plugin::$session->data['pmxi_import']['template'], 'options' => PMXI_Plugin::$session->data['pmxi_import']['options'], 'count' => PMXI_Plugin::$session->data['pmxi_import']['count'], 'friendly_name' => PMXI_Plugin::$session->data['pmxi_import']['options']['friendly_name'], 'feed_type' => PMXI_Plugin::$session->data['pmxi_import']['feed_type'], 'parent_import_id' => $this->data['update_previous']->isEmpty() ? PMXI_Plugin::$session->data['pmxi_import']['parent_import_id'] : $this->data['update_previous']->parent_import_id, 'queue_chunk_number' => 0, 'triggered' => 0, 'processing' => 0, 'iteration' => !empty($import->iteration) ? $import->iteration : 0))->save();
            if (PMXI_Plugin::$session->data['pmxi_import']['action'] != 'continue') {
                // store import info in database
                $import->set(array('imported' => 0, 'created' => 0, 'updated' => 0, 'skipped' => 0))->update();
            }
            foreach (get_taxonomies() as $tax) {
                delete_transient("pmxi_{$tax}_terms");
            }
            do_action('pmxi_before_xml_import', $import->id);
            PMXI_Plugin::$session['pmxi_import']['update_previous'] = $import->id;
            // unlick previous files
            $history = new PMXI_File_List();
            $history->setColumns('id', 'name', 'registered_on', 'path')->getBy(array('import_id' => $import->id), 'id DESC');
            if ($history->count()) {
                foreach ($history as $file) {
                    if (@file_exists($file['path']) and $file['path'] != PMXI_Plugin::$session->data['pmxi_import']['filePath']) {
                        @unlink($file['path']);
                    }
                    $history_file = new PMXI_File_Record();
                    $history_file->getBy('id', $file['id']);
                    if (!$history_file->isEmpty()) {
                        $history_file->delete();
                    }
                }
            }
            if ($save_history) {
                $history_file = new PMXI_File_Record();
                $history_file->set(array('name' => $import->name, 'import_id' => $import->id, 'path' => PMXI_Plugin::$session->data['pmxi_import']['filePath'], 'contents' => $this->get_xml(), 'registered_on' => date('Y-m-d H:i:s')))->save();
            }
            /*
            	Split file up into 1000 record chunks.			
            	This option will decrease the amount of slowdown experienced at the end of large imports. 
            	The slowdown is partially caused by the need for WP All Import to read deeper and deeper into the file on each successive iteration. 
            	Splitting the file into pieces means that, for example, instead of having to read 19000 records into a 20000 record file when importing the last 1000 records, 
            	WP All Import will just split it into 20 chunks, and then read the last chunk from the beginning.
            */
            if ("ajax" == $import->options['import_processing'] and $import->count > PMXI_Plugin::getInstance()->getOption('large_feed_limit') and $import->options['chuncking']) {
                $chunk_files = array();
                if (!empty(PMXI_Plugin::$session->data['pmxi_import']['local_paths'])) {
                    $records_count = 0;
                    $chunk_records_count = 0;
                    $feed = "<?xml version=\"1.0\" encoding=\"" . $import->options['encoding'] . "\"?>" . "\n" . "<pmxi_records>";
                    foreach (PMXI_Plugin::$session->data['pmxi_import']['local_paths'] as $key => $path) {
                        $file = new PMXI_Chunk($path, array('element' => $import->root_element, 'encoding' => $import->options['encoding']));
                        // loop through the file until all lines are read
                        while ($xml = $file->read()) {
                            if (!empty($xml)) {
                                PMXI_Import_Record::preprocessXml($xml);
                                $chunk = "<?xml version=\"1.0\" encoding=\"" . $import->options['encoding'] . "\"?>" . "\n" . $xml;
                                $dom = new DOMDocument('1.0', $import->options['encoding']);
                                $old = libxml_use_internal_errors(true);
                                $dom->loadXML($chunk);
                                // FIX: libxml xpath doesn't handle default namespace properly, so remove it upon XML load
                                libxml_use_internal_errors($old);
                                $xpath = new DOMXPath($dom);
                                if ($elements = @$xpath->query($import->xpath) and $elements->length) {
                                    $records_count += $elements->length;
                                    $chunk_records_count += $elements->length;
                                    $feed .= $xml;
                                }
                            }
                            if ($chunk_records_count == PMXI_Plugin::getInstance()->getOption('large_feed_limit') or $records_count == $import->count) {
                                $feed .= "</pmxi_records>";
                                $chunk_file_path = $wp_uploads['path'] . "/pmxi_chunk_" . count($chunk_files) . "_" . basename($path);
                                file_put_contents($chunk_file_path, $feed);
                                $chunk_files[] = $chunk_file_path;
                                $chunk_records_count = 0;
                                $feed = "<?xml version=\"1.0\" encoding=\"" . $import->options['encoding'] . "\"?>" . "\n" . "<pmxi_records>";
                            }
                        }
                    }
                    PMXI_Plugin::$session['pmxi_import']['local_paths'] = $chunk_files;
                }
            }
            pmxi_session_commit();
            $this->render();
            wp_ob_end_flush_all();
            flush();
            @set_time_limit(0);
            if ("ajax" == $import->options['import_processing']) {
                die;
            }
        } elseif (empty($import->id)) {
            $import = new PMXI_Import_Record();
            $import->getById(PMXI_Plugin::$session->data['pmxi_import']['update_previous']);
        }
        $ajax_processing = "ajax" == $import->options['import_processing'] ? true : false;
        PMXI_Plugin::$session['pmxi_import']['start_time'] = empty(PMXI_Plugin::$session->data['pmxi_import']['start_time']) ? time() : PMXI_Plugin::$session->data['pmxi_import']['start_time'];
        wp_cache_flush();
        if (PMXI_Plugin::is_ajax() or !$ajax_processing) {
            if ("ajax" == $import->options['import_processing']) {
//.........这里部分代码省略.........
开发者ID:thabofletcher,项目名称:tc-site,代码行数:101,代码来源:import.php


示例7: __construct


//.........这里部分代码省略.........
     $this->version = '2.2';
     $this->time = intval($timestart);
     $this->plugin_dir = dirname(plugin_basename(__FILE__));
     $this->text_domain = 'backup';
     // Enable internationalization
     load_plugin_textdomain($this->text_domain, false, $this->plugin_dir . '/languages');
     $this->scope = array('https://www.googleapis.com/auth/drive.file', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email', 'https://docs.google.com/feeds/', 'https://docs.googleusercontent.com/', 'https://spreadsheets.google.com/feeds/');
     $this->http_transports = array('curl', 'streams', 'fsockopen');
     $this->schedules = array('weekly' => array('interval' => 604800, 'display' => __('Weekly', $this->text_domain)), 'monthly' => array('interval' => 2592000, 'display' => __('Monthly', $this->text_domain)));
     $this->redirect_uri = admin_url('options-general.php?page=backup&action=auth');
     // Get options if they exist, else set defaults
     if (!($this->options = get_option('backup_options'))) {
         $this->options = array('plugin_version' => $this->version, 'backup_token' => '', 'refresh_token' => '', 'backup_title' => get_bloginfo('name'), 'local_folder' => '', 'drive_folder' => '', 'backup_frequency' => 'never', 'source_list' => array('database', 'content', 'uploads', 'plugins'), 'exclude_list' => array('.svn', '.git', '.DS_Store'), 'include_list' => array(), 'backup_list' => array(), 'client_id' => '', 'client_secret' => '', 'local_number' => 1, 'drive_number' => 10, 'quota_total' => '', 'quota_used' => '', 'chunk_size' => 1, 'time_limit' => 600, 'backup_attempts' => 3, 'request_timeout' => 60, 'enabled_transports' => $this->http_transports, 'ssl_verify' => true, 'email_notify' => false, 'user_info' => array());
     } else {
         if (!isset($this->options['plugin_version']) || version_compare($this->version, $this->options['plugin_version'], '>')) {
             add_action('init', array(&$this, 'upgrade'), 1);
         }
     }
     // Allow some options to be overwritten from the config file.
     if (defined('BACKUP_REFRESH_TOKEN')) {
         $this->options['refresh_token'] = BACKUP_REFRESH_TOKEN;
     }
     if (defined('BACKUP_DRIVE_FOLDER')) {
         $this->options['drive_folder'] = BACKUP_DRIVE_FOLDER;
     }
     if (defined('BACKUP_CLIENT_ID')) {
         $this->options['client_id'] = BACKUP_CLIENT_ID;
     }
     if (defined('BACKUP_CLIENT_SECRET')) {
         $this->options['client_secret'] = BACKUP_CLIENT_SECRET;
     }
     if (defined('BACKUP_LOCAL_FOLDER')) {
         $this->options['local_folder'] = BACKUP_LOCAL_FOLDER;
     }
     $this->local_folder = absolute_path($this->options['local_folder'], ABSPATH);
     if (defined('BACKUP_LOCAL_FOLDER')) {
         $this->create_dir($this->local_folder);
     }
     $this->dump_file = $this->local_folder . '/dump.sql';
     $upload_dir = wp_upload_dir();
     $this->sources = array('database' => array('title' => __('Database', $this->text_domain), 'path' => $this->dump_file), 'content' => array('title' => __('Content', $this->text_domain), 'path' => WP_CONTENT_DIR), 'uploads' => array('title' => __('Uploads', $this->text_domain), 'path' => $upload_dir['basedir']), 'plugins' => array('title' => __('Plugins', $this->text_domain), 'path' => WP_PLUGIN_DIR), 'wordpress' => array('title' => __('WordPress', $this->text_domain), 'path' => ABSPATH));
     $this->exclude[] = $this->local_folder;
     register_activation_hook(__FILE__, array(&$this, 'activate'));
     // Add custom cron intervals
     add_filter('cron_schedules', array(&$this, 'cron_add_intervals'));
     // Link to the settings page from the plugins page
     add_filter('plugin_action_links', array(&$this, 'action_links'), 10, 2);
     // Disable unwanted HTTP transports.
     if (isset($this->options['enabled_transports'])) {
         foreach ($this->http_transports as $t) {
             if (!in_array($t, $this->options['enabled_transports'])) {
                 add_filter('use_' . $t . '_transport', '__return_false');
             }
         }
     }
     // Add 'Backup' to the Settings admin menu; save default metabox layout in the database.
     add_action('admin_menu', array(&$this, 'backup_menu'));
     // Handle Google OAuth2.
     if ($this->is_auth()) {
         add_action('init', array(&$this, 'auth'));
     }
     // Display persistent error notifications if we have any.
     if (isset($this->options['messages']['error'])) {
         add_action('admin_notices', array(&$this, 'error_notice'), 3);
     }
     // Print admin notices.
     add_action('admin_notices', array(&$this, 'print_notices'), 2);
     // Do backup on schedule.
     add_action('backup_schedule', array(&$this, 'do_backup'));
     // Retry to backup after a failed attempt.
     add_action('backup_retry', array(&$this, 'retry_backup'));
     // Do stuff just before the end of script execution.
     add_action('shutdown', array(&$this, 'shutdown'));
     // Prepare GOAuth object.
     $this->goauth = new GOAuth(array('client_id' => $this->options['client_id'], 'client_secret' => $this->options['client_secret'], 'redirect_uri' => $this->redirect_uri, 'refresh_token' => $this->options['refresh_token'], 'request_timeout' => $this->options['request_timeout'], 'ssl_verify' => $this->options['ssl_verify']));
     // If we're doing backup work set the environment accordingly.
     if ($this->doing_backup()) {
         if (get_transient('backup_lock')) {
             exit;
         }
         // Exit if another backup process is running.
         set_transient('backup_lock', $this->time, 60 * 60 * 24);
         add_action('shutdown', array(&$this, 'unlock'));
         // Enable manual backup URI.
         add_action('template_redirect', array(&$this, 'manual_backup'));
         @ini_set('safe_mode', 0);
         // Try to disable safe mode.
         set_time_limit($this->options['time_limit']);
         // Set the time limit.
         // We might need a lot of memory for backing up.
         @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
         ignore_user_abort(true);
         // Allow the script to run after the user closes the window.
         // All this is needed in order that every echo gets sent to the browser.
         @ini_set('zlib.output_compression', 0);
         @ini_set('implicit_flush', 1);
         wp_ob_end_flush_all();
         ob_implicit_flush();
     }
 }
开发者ID:DylanGroenewoud,项目名称:PVNG,代码行数:101,代码来源:backup.php


示例8: gmedia_import_files

 /**
  * @param     $files
  * @param     $terms
  * @param     $move
  * @param int|string $exists
  */
 function gmedia_import_files($files, $terms, $move, $exists = 0)
 {
     global $gmCore, $gmGallery, $gmDB;
     if (ob_get_level() == 0) {
         ob_start();
     }
     $eol = '</pre>' . PHP_EOL;
     $_terms = $terms;
     $gmedia_album = isset($_terms['gmedia_album']) ? $_terms['gmedia_album'] : false;
     if ($gmedia_album && $gmCore->is_digit($gmedia_album)) {
         $album = $gmDB->get_term($gmedia_album, 'gmedia_album');
         if (empty($album) || is_wp_error($album)) {
             $status = 'public';
         } else {
             $status = $album->status;
             $album_name = $album->name;
         }
     } else {
         $status = 'public';
     }
     $c = count($files);
     $i = 0;
     foreach ($files as $file) {
         if (is_array($file)) {
             if (isset($file['file'])) {
                 extract($file);
             } else {
                 _e('Something went wrong...', 'gmLang');
                 die;
             }
         }
         wp_ob_end_flush_all();
         flush();
         $i++;
         $prefix = "\n<pre>{$i}/{$c} - ";
         $prefix_ko = "\n<pre class='ko'>{$i}/{$c} - ";
         if (!is_file($file)) {
             echo $prefix_ko . sprintf(__('File not exists: %s', 'gmLang'), $file) . $eol;
             continue;
         }
         if ('skip' === $exists) {
             $file_suffix = false;
         } else {
             $file_suffix = $exists;
         }
         $fileinfo = $gmCore->fileinfo($file, $file_suffix);
         if ('skip' === $exists && file_exists($fileinfo['filepath'])) {
             echo $prefix . $fileinfo['basename'] . ': ' . __('file already exists', 'gmLang') . $eol;
             continue;
         }
         // try to make grand-media dir if not exists
         if (!wp_mkdir_p($fileinfo['dirpath'])) {
             echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'gmLang'), $fileinfo['dirpath']) . $eol;
             continue;
         }
         // Check if grand-media dir is writable
         if (!is_writable($fileinfo['dirpath'])) {
             @chmod($fileinfo['dirpath'], 0755);
             if (!is_writable($fileinfo['dirpath'])) {
                 echo $prefix_ko . sprintf(__('Directory `%s` or its subfolders are not writable by the server.', 'gmLang'), dirname($fileinfo['dirpath'])) . $eol;
                 continue;
             }
         }
         if (!copy($file, $fileinfo['filepath'])) {
             echo $prefix_ko . sprintf(__("Can't copy file from `%s` to `%s`", 'gmLang'), $file, $fileinfo['filepath']) . $eol;
             continue;
         }
         $gmCore->file_chmod($fileinfo['filepath']);
         $size = false;
         $is_webimage = false;
         if ('image' == $fileinfo['dirname']) {
             /** WordPress Image Administration API */
             require_once ABSPATH . 'wp-admin/includes/image.php';
             $size = @getimagesize($fileinfo['filepath']);
             if ($size && file_is_displayable_image($fileinfo['filepath'])) {
                 if (function_exists('memory_get_usage')) {
                     $extensions = array('1' => 'GIF', '2' => 'JPG', '3' => 'PNG', '6' => 'BMP');
                     switch ($extensions[$size[2]]) {
                         case 'GIF':
                             $CHANNEL = 1;
                             break;
                         case 'JPG':
                             $CHANNEL = $size['channels'];
                             break;
                         case 'PNG':
                             $CHANNEL = 3;
                             break;
                         case 'BMP':
                         default:
                             $CHANNEL = 6;
                             break;
                     }
                     $MB = 1048576;
                     // number of bytes in 1M
//.........这里部分代码省略.........
开发者ID:HugoLS,项目名称:Variation,代码行数:101,代码来源:core.php


示例9: handle_imports

 function handle_imports()
 {
     if (!empty($_POST['files']) && !empty($_POST['cwd'])) {
         $files = wp_unslash($_POST['files']);
         $cwd = trailingslashit(wp_unslash($_POST['cwd']));
         $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
         $import_date = isset($_REQUEST['import-date']) ? $_REQUEST['import-date'] : 'current';
         $import_to_gallery = isset($_POST['gallery']) && 'on' == $_POST['gallery'];
         if (!$import_to_gallery && !isset($_REQUEST['cwd'])) {
             $import_to_gallery = true;
             // cwd should always be set, if it's not, and neither is gallery, this must be the first page load.
         }
         if (!$import_to_gallery) {
             $post_id = 0;
         }
         flush();
         wp_ob_end_flush_all();
         foreach ((array) $files as $file) {
             $filename = $cwd . $file;
             $id = $this->handle_import_file($filename, $post_id, $import_date);
             if (is_wp_error($id)) {
                 echo '<div class="updated error"><p>' . sprintf(__('<em>%s</em> was <strong>not</strong> imported due to an error: %s', 'add-from-server'), esc_html($file), $id->get_error_message()) . '</p></div>';
             } else {
                 echo '<div class="updated"><p>' . sprintf(__('<em>%s</em> has been added to Media library', 'add-from-server'), esc_html($file)) . '</p></div>';
             }
             flush();
             wp_ob_end_flush_all();
         }
     }
 }
开发者ID:Ezyva2015,项目名称:money101.com.au,代码行数:30,代码来源:class.add-from-server.php


示例10: show_message

/**
 * {@internal Missing Short Description}}
 *
 * @since 2.1.0
 *
 * @param unknown_type $message
 */
function show_message($message) {
	if ( is_wp_error($message) ){
		if ( $message->get_error_data() )
			$message = $message->get_error_message() . ': ' . $message->get_error_data();
		else
			$message = $message->get_error_message();
	}
	echo "<p>$message</p>\n";
	wp_ob_end_flush_all();
	flush();
}
开发者ID:pauEscarcia,项目名称:AIMM,代码行数:18,代码来源:MISC.PHP


示例11: hippo_flush_buffer

 function hippo_flush_buffer()
 {
     wp_ob_end_flush_all();
     @ob_flush();
     flush();
 }
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:6,代码来源:contents.php


示例12: stream_import

 /**
  * Run an import, and send an event-stream response.
  *
  * Streams logs and success messages to the browser to allow live status
  * and updates.
  */
 public function stream_import()
 {
     // Turn off PHP output compression
     @ini_set('output_buffering', 'off');
     @ini_set('zlib.output_compression', false);
     if ($GLOBALS['is_nginx']) {
         // Setting this header instructs Nginx to disable fastcgi_buffering
         // and disable gzip for this request.
         header('X-Accel-Buffering: no');
         header('Content-Encoding: none');
     }
     // Start the event stream.
     header('Content-Type: text/event-stream');
     $this->id = wp_unslash((int) $_REQUEST['id']);
     $settings = get_post_meta($this->id, '_wxr_import_settings', true);
     if (empty($settings)) {
         // Tell the browser to stop reconnecting.
         status_header(204);
         exit;
     }
     // 2KB padding for IE
     echo ':' . str_repeat(' ', 2048) . "\n\n";
     // Time to run the import!
     set_time_limit(0);
     // Ensure we're not buffered.
     wp_ob_end_flush_all();
     flush();
     $mapping = $settings['mapping'];
     $this->fetch_attachments = (bool) $settings['fetch_attachments'];
     $importer = $this->get_importer();
     if (!empty($mapping['mapping'])) {
         $importer->set_user_mapping($mapping['mapping']);
     }
     if (!empty($mapping['slug_overrides'])) {
         $importer->set_user_slug_overrides($mapping['slug_overrides']);
     }
     // Are we allowed to create users?
     if (!$this->allow_create_users()) {
         add_filter('wxr_importer.pre_process.user', '__return_null');
     }
     // Keep track of our progress
     add_action('wxr_importer.processed.post', array($this, 'imported_post'), 10, 2);
     add_action('wxr_importer.process_failed.post', array($this, 'imported_post'), 10, 2);
     add_action('wxr_importer.processed.comment', array($this, 'imported_comment'));
     add_action('wxr_importer.processed.term', array($this, 'imported_term'));
     add_action('wxr_importer.process_failed.term', array($this, 'imported_term'));
     add_action('wxr_importer.processed.user', array($this, 'imported_user'));
     add_action('wxr_importer.process_failed.user', array($this, 'imported_user'));
     // Clean up some memory
     unset($settings);
     // Flush once more.
     flush();
     $file = get_attached_file($this->id);
     $err = $importer->import($file);
     // Remove the settings to stop future reconnects.
     delete_post_meta($this->id, '_wxr_import_settings');
     // Let the browser know we're done.
     $complete = array('action' => 'complete', 'error' => false);
     if (is_wp_error($err)) {
         $complete['error'] = $err->get_error_message();
     }
     $this->emit_sse_message($complete);
     exit;
 }
开发者ID:kucrut,项目名称:WordPress-Importer,代码行数:70,代码来源:class-wxr-import-ui.php


示例13: gmedia_images_update

/**
 * @param $files
 */
function gmedia_images_update($files)
{
    global $wpdb, $gmCore, $gmGallery;
    if (ob_get_level() == 0) {
        ob_start();
    }
    $eol = '</pre>' . PHP_EOL;
    $c = count($files);
    $i = 0;
    foreach ($files as $file) {
        /**
         * @var $file
         * @var $id
         */
        if (is_array($file)) {
            if (isset($file['file'])) {
                extract($file);
            } else {
                _e('Something went wrong...', 'gmLang');
                die;
            }
        }
        wp_ob_end_flush_all();
        $i++;
        $prefix = "\n<pre style='display:block;'>{$i}/{$c} - ";
        $prefix_ko = "\n<pre style='display:block;color:darkred;'>{$i}/{$c} - ";
        if (!is_file($file)) {
            $fileinfo = $gmCore->fileinfo($file, false);
            if (is_file($fileinfo['filepath_original'])) {
                @rename($fileinfo['filepath_original'], $fileinfo['filepath']);
            } else {
                echo $prefix_ko . sprintf(__('File not exists: %s', 'gmLang'), $file) . $eol;
                continue;
            }
        }
        $file_File = $file;
        $fileinfo = $gmCore->fileinfo($file, false);
        if ($file_File != $fileinfo['filepath']) {
            @rename($file_File, $fileinfo['filepath']);
            $wpdb->update($wpdb->prefix . 'gmedia', array('gmuid' => $fileinfo['basename']), array('gmuid' => basename($file_File)));
        }
        if ('image' == $fileinfo['dirname']) {
            $size = @getimagesize($fileinfo['filepath']);
            if (!file_exists($fileinfo['filepath_thumb']) && file_is_displayable_image($fileinfo['filepath'])) {
                if (function_exists('memory_get_usage')) {
                    $extensions = array('1' => 'GIF', '2' => 'JPG', '3' => 'PNG', '6' => 'BMP');
                    switch ($extensions[$size[2]]) {
                        case 'GIF':
                            $CHANNEL = 1;
                            break;
                        case 'JPG':
                            $CHANNEL = $size['channels'];
                            break;
                        case 'PNG':
                            $CHANNEL = 3;
                            break;
                        case 'BMP':
                        default:
                            $CHANNEL = 6;
                            break;
                    }
                    $MB = 1048576;
                    // number of bytes in 1M
                    $K64 = 65536;
                    // number of bytes in 64K
                    $TWEAKFACTOR = 1.8;
                    // Or whatever works for you
                    $memoryNeeded = round(($size[0] * $size[1] * $size['bits'] * $CHANNEL / 8 + $K64) * $TWEAKFACTOR);
                    $memoryNeeded = memory_get_usage() + $memoryNeeded;
                    $current_limit = @ini_get('memory_limit');
                    $current_limit_int = intval($current_limit);
                    if (false !== strpos($current_limit, 'M')) {
                        $current_limit_int *= $MB;
                    }
                    if (false !== strpos($current_limit, 'G')) {
                        $current_limit_int *= 1024;
                    }
                    if (-1 != $current_limit && $memoryNeeded > $current_limit_int) {
                        $newLimit = $current_limit_int / $MB + ceil(($memoryNeeded - $current_limit_int) / $MB);
                        @ini_set('memory_limit', $newLimit . 'M');
                    }
                }
                if (!wp_mkdir_p($fileinfo['dirpath_thumb'])) {
                    echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'gmLang'), $fileinfo['dirpath_thumb']) . $eol;
                    continue;
                }
                if (!is_writable($fileinfo['dirpath_thumb'])) {
                    @chmod($fileinfo['dirpath_thumb'], 0755);
                    if (!is_writable($fileinfo['dirpath_thumb'])) {
                        echo $prefix_ko . sprintf(__('Directory `%s` is not writable by the server.', 'gmLang'), $fileinfo['dirpath_thumb']) . $eol;
                        continue;
                    }
                }
                if (!wp_mkdir_p($fileinfo['dirpath_original'])) {
                    echo $prefix_ko . sprintf(__('Unable to create directory `%s`. Is its parent directory writable by the server?', 'gmLang'), $fileinfo['dirpath_original']) . $eol;
                    continue;
                }
//.........这里部分代码省略.........
开发者ID:HugoLS,项目名称:Variation,代码行数:101,代码来源:update.php


示例14: after_flush_output

 /**
  * Flush footer output buffer and iterate $this->i to make sure the
  * installation strings reference the correct plugin.
  *
  * @since 2.2.0
  */
 public function after_flush_output()
 {
     wp_ob_end_flush_all();
     flush();
     $this->i++;
 }
开发者ID:luxifel,项目名称:Bionerd,代码行数:12,代码来源:td-old-class-tgm-plugin-activation.php


示例15: flush_output

 /**
  * Flush output to browser
  *
  * @return void
  */
 private function flush_output()
 {
     wp_ob_end_flush_all();
     flush();
 }
开发者ID:visitcasabacardi,项目名称:backup-nov-08-2015,代码行数:10,代码来源:Upgrader.php


示例16: flush_output

	/**
	 * @access 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_oembed_add_provider函数代码示例发布时间:2022-05-23
下一篇:
PHP wp_notify_postauthor函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap