progress.php

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 1,872 行 · 第 1/5 页

PHP
1,872
字号
<?php
/**
 * The HTML_Progress class allow you to add a loading bar
 * to any of your xhtml document.
 * You should have a browser that accept DHTML feature.
 *
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category   HTML
 * @package    HTML_Progress
 * @author     Laurent Laville <pear@laurent-laville.org>
 * @copyright  1997-2005 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    CVS: $Id: Progress.php,v 1.15 2005/07/25 13:11:26 farell Exp $
 * @link       http://pear.php.net/package/HTML_Progress
 * @tutorial   HTML_Progress.pkg
 */

require_once 'HTML/Progress/DM.php';
require_once 'HTML/Progress/UI.php';

/**#@+
 * Progress Bar shape types
 *
 * @var        integer
 * @since      0.6
 */
define ('HTML_PROGRESS_BAR_HORIZONTAL', 1);
define ('HTML_PROGRESS_BAR_VERTICAL',   2);
/**#@-*/

/**#@+
 * Progress Bar shape types
 *
 * @var        integer
 * @since      1.2.0RC1
 */
define ('HTML_PROGRESS_POLYGONAL',      3);
define ('HTML_PROGRESS_CIRCLE',         4);
/**#@-*/

/**
 * Basic error code that indicate a wrong input
 *
 * @var        integer
 * @since      1.0
 */
define ('HTML_PROGRESS_ERROR_INVALID_INPUT',   -100);

/**
 * Basic error code that indicate a wrong callback definition.
 * Allows only function or class-method structure.
 *
 * @var        integer
 * @since      1.1
 */
define ('HTML_PROGRESS_ERROR_INVALID_CALLBACK',-101);

/**
 * Basic error code that indicate a deprecated method
 * that may be removed at any time from a future version
 *
 * @var        integer
 * @since      1.2.0RC1
 */
define ('HTML_PROGRESS_DEPRECATED',            -102);

/**#@+
 * One of five possible return values from the error Callback
 *
 * @see        HTML_Progress::_handleError
 * @var        integer
 * @since      1.2.0
 */
/**
 * If this is returned, then the error will be both pushed onto the stack
 * and logged.
 */
define('HTML_PROGRESS_ERRORSTACK_PUSHANDLOG', 1);
/**
 * If this is returned, then the error will only be pushed onto the stack,
 * and not logged.
 */
define('HTML_PROGRESS_ERRORSTACK_PUSH', 2);
/**
 * If this is returned, then the error will only be logged, but not pushed
 * onto the error stack.
 */
define('HTML_PROGRESS_ERRORSTACK_LOG', 3);
/**
 * If this is returned, then the error is completely ignored.
 */
define('HTML_PROGRESS_ERRORSTACK_IGNORE', 4);
/**
 * If this is returned, then the error will only be logged, but not pushed
 * onto the error stack because will halt script execution.
 */
define('HTML_PROGRESS_ERRORSTACK_LOGANDDIE', 5);
/**#@-*/


/**#@+
 * Log types for PHP's native error_log() function
 *
 * @see        HTML_Progress::_errorHandler
 * @var        integer
 * @since      1.2.0
 */
/**
 * Use PHP's system logger
 */
define('HTML_PROGRESS_LOG_TYPE_SYSTEM',  0);
/**
 * Use PHP's mail() function
 */
define('HTML_PROGRESS_LOG_TYPE_MAIL',    1);
/**
 * Append to a file
 */
define('HTML_PROGRESS_LOG_TYPE_FILE',    3);
/**#@-*/

/**
 * Global error message callback.
 * This will be used to generate the error message
 * from the error code.
 *
 * @global     false|string|array      $GLOBALS['_HTML_PROGRESS_CALLBACK_MESSAGE']
 * @since      1.2.0
 * @access     private
 * @see        HTML_Progress::_initErrorHandler
 */
$GLOBALS['_HTML_PROGRESS_CALLBACK_MESSAGE'] = false;

/**
 * Global error context callback.
 * This will be used to generate the error context for an error.
 *
 * @global     false|string|array      $GLOBALS['_HTML_PROGRESS_CALLBACK_CONTEXT']
 * @since      1.2.0
 * @access     private
 * @see        HTML_Progress::_initErrorHandler
 */
$GLOBALS['_HTML_PROGRESS_CALLBACK_CONTEXT'] = false;

/**
 * Global error push callback.
 * This will be called every time an error is pushed onto the stack.
 * The return value will be used to determine whether to allow
 * an error to be pushed or logged.
 *
 * @global     false|string|array      $GLOBALS['_HTML_PROGRESS_CALLBACK_PUSH']
 * @since      1.2.0
 * @access     private
 * @see        HTML_Progress::_initErrorHandler
 */
$GLOBALS['_HTML_PROGRESS_CALLBACK_PUSH'] = false;

/**
 * Global error handler callback.
 * This will handle any errors raised by this package.
 *
 * @global     false|string|array      $GLOBALS['_HTML_PROGRESS_CALLBACK_ERRORHANDLER']
 * @since      1.2.0
 * @access     private
 * @see        HTML_Progress::_initErrorHandler
 */
$GLOBALS['_HTML_PROGRESS_CALLBACK_ERRORHANDLER'] = false;

/**
 * Global associative array of key-value pairs
 * that are used to specify any handler-specific settings.
 *
 * @global     array                   $GLOBALS['_HTML_PROGRESS_ERRORHANDLER_OPTIONS']
 * @since      1.2.0
 * @access     private
 * @see        HTML_Progress::_initErrorHandler
 */
$GLOBALS['_HTML_PROGRESS_ERRORHANDLER_OPTIONS'] = array();

/**
 * Global error stack for this package.
 *
 * @global     array                   $GLOBALS['_HTML_PROGRESS_ERRORSTACK']
 * @since      1.2.0
 * @access     private
 * @see        HTML_Progress::raiseError
 */
$GLOBALS['_HTML_PROGRESS_ERRORSTACK'] = array();


/**
 * The HTML_Progress class allow you to add a loading bar
 * to any of your xhtml document.
 * You should have a browser that accept DHTML feature.
 *
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category   HTML
 * @package    HTML_Progress
 * @author     Laurent Laville <pear@laurent-laville.org>
 * @copyright  1997-2005 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    Release: 1.2.2
 * @link       http://pear.php.net/package/HTML_Progress
 */

class HTML_Progress
{
    /**
     * Whether the progress bar is in determinate or indeterminate mode.
     * The default is false.
     * An indeterminate progress bar continuously displays animation indicating
     * that an operation of unknown length is occuring.
     *
     * @var        boolean
     * @since      1.0
     * @access     private
     * @see        setIndeterminate(), isIndeterminate()
     */
    var $_indeterminate;

    /**
     * Whether to display a border around the progress bar.
     * The default is false.
     *
     * @var        boolean
     * @since      1.0
     * @access     private
     * @see        setBorderPainted(), isBorderPainted()
     */
    var $_paintBorder;

    /**
     * Whether to textually display a string on the progress bar.
     * The default is false.
     * Setting this to true causes a textual display of the progress to be rendered
     * on the progress bar. If the $_progressString is null, the percentage of completion
     * is displayed on the progress bar. Otherwise, the $_progressString is rendered
     * on the progress bar.
     *
     * @var        boolean
     * @since      1.0
     * @access     private
     * @see        setStringPainted(), isStringPainted()
     */
    var $_paintString;

    /**
     * An optional string that can be displayed on the progress bar.
     * The default is null.
     * Setting this to a non-null value does not imply that the string
     * will be displayed.
     *
     * @var        string
     * @since      1.0
     * @access     private
     * @see        getString(), setString()
     */
    var $_progressString;

    /**
     * The data model (HTML_Progress_DM instance or extends)
     * handles any mathematical issues arising from assigning faulty values.
     *
     * @var        object
     * @since      1.0
     * @access     private
     * @see        getDM(), setDM()
     */
    var $_DM;

    /**
     * The user interface (HTML_Progress_UI instance or extends)
     * handles look-and-feel of the progress bar.
     *
     * @var        object
     * @since      1.0
     * @access     private
     * @see        getUI(), setUI()
     */
    var $_UI;

    /**
     * The label that uniquely identifies this progress object.
     *
     * @var        string
     * @since      1.0
     * @access     private
     * @see        getIdent(), setIdent()
     */
    var $_ident;

    /**
     * Holds all HTML_Progress_Observer objects that wish to be notified of new messages.
     *
     * @var        array
     * @since      1.0
     * @access     private
     * @see        getListeners(), addListener(), removeListener()
     */
    var $_listeners;

    /**
     * Delay in milisecond before each progress cells display.
     * 1000 ms === sleep(1)
     * <strong>usleep()</strong> function does not run on Windows platform.
     *
     * @var        integer
     * @since      1.1
     * @access     private
     * @see        setAnimSpeed()
     */
    var $_anim_speed;

    /**
     * Callback, either function name or array(&$object, 'method')
     *
     * @var        mixed
     * @since      1.2.0RC3
     * @access     private
     * @see        setProgressHandler()
     */
    var $_callback = null;


    /**
     * Constructor Summary
     *
     * o Creates a natural horizontal progress bar that displays ten cells/units
     *   with no border and no progress string.
     *   The initial and minimum values are 0, and the maximum is 100.
     *   <code>
     *   $bar = new HTML_Progress();
     *   </code>
     *
     * o Creates a natural progress bar with the specified orientation, which can be
     *   either HTML_PROGRESS_BAR_HORIZONTAL or HTML_PROGRESS_BAR_VERTICAL
     *   By default, no border and no progress string are painted.
     *   The initial and minimum values are 0, and the maximum is 100.
     *   <code>
     *   $bar = new HTML_Progress($orient);
     *   </code>
     *
     * o Creates a natural horizontal progress bar with the specified minimum and
     *   maximum. Sets the initial value of the progress bar to the specified
     *   minimum, and the maximum that the progress bar can reach.
     *   By default, no border and no progress string are painted.
     *   <code>
     *   $bar = new HTML_Progress($min, $max);
     *   </code>
     *
     * o Creates a natural horizontal progress bar with the specified orientation,
     *   minimum and maximum. Sets the initial value of the progress bar to the
     *   specified minimum, and the maximum that the progress bar can reach.
     *   By default, no border and no progress string are painted.
     *   <code>
     *   $bar = new HTML_Progress($orient, $min, $max);
     *   </code>
     *
     * o Creates a natural horizontal progress that uses the specified model
     *   to hold the progress bar's data.
     *   By default, no border and no progress string are painted.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?