b_migration12.pkg

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PKG 代码 · 共 113 行

PKG
113
字号
<!-- $Revision: 1.2 $ -->

<refentry id="{@id}">

 <refnamediv>
  <refname>Appendix B. Migration to version 1.2</refname>
  <refpurpose>API changes to observe</refpurpose>
 </refnamediv>

 <refsect1 id="{@id why-changes}">
  <title>Why these changes ?</title>
  <para>
   HTML_Progress has improved a lot since version 1.1. New features and easy short links comes,
   but also some functionalities was removed.
   <simpara>
    With release 1.2 <classname>HTML_Progress_Model</classname> class was removed, making
    HTML_Progress package much lighter. But don't worry, the feature still exists:
    see {@tutorial progress.setmodel.pkg HTML_Progress::setModel} method.
   </simpara>
  </para>
 </refsect1>

 <refsect1 id="{@id adjust-code}">
  <title>How to adjust your code</title>
  <refsect2 id="{@id progress-display}">
   <title>HTML_Progress::display()</title>
   <para>
    <simpara>
     When you coded a loop such as:
     <example>
      <programlisting role="php">
      <![CDATA[
<?php
require_once 'HTML/Progress.php';

$bar = new HTML_Progress();

// ...

do {
    $bar->display();
    if ($bar->getPercentComplete() == 1) {
        $break;
    } 
    $bar->incValue();
} while(1)
?>
      ]]>
      </programlisting>
     </example>
      the sleep action in version 1.1 (an empty for-loop) was included inside 
      <emphasis>HTML_Progress::display</emphasis> method.
      Now in version 1.2 a new API comes: {@tutorial progress.sleep.pkg HTML_Progress::sleep}
      which used in most case the PHP function {@link http://www.php.net/manual/en/function.usleep.php},
      rather than an empty for-loop. You should include this new method in your do-while loop,
      as in implementation below:
    </simpara>
    <simpara>
     <example>
      <programlisting role="php">
      <![CDATA[
<?php
require_once 'HTML/Progress.php';

$bar = new HTML_Progress();

// ...

do {
    $bar->display();
    if ($bar->getPercentComplete() == 1) {
        $break;
    } 
    $bar->sleep();
    $bar->incValue();
} while(1)
?>
      ]]>
      </programlisting>
     </example>
    </simpara>
    <para>
     <tip>
      Of course, you need the HTML_Progress::sleep method only to produce demonstration. In real
      world the user task should at least enough long to delay and smooth progress meter animation.
     </tip>
    </para>
   </para>
  </refsect2>
    
  <refsect2 id="{@id progress-run}">
   <title>HTML_Progress::run()</title>
   <para>
    This new API allows to replace a do-while loop as in above example.
    Its also allows to call a user-callback defined by {@tutorial progress.setprogresshandler.pkg}
    and manage both progress meter mode (determinate and indeterminate).
   </para>
  </refsect2>

  <refsect2 id="{@id progress-run}">
   <title>HTML_Progress::hasErrors(), HTML_Progress::getError()</title>
    <para>
     These new API allows to catch HTML_Progress internal errors more easily. 
     See {@tutorial part2-errorhandling.pkg} for details.
    </para>
    <simpara>
     {@example haserrors.php}
    </simpara>
  </refsect2>
 </refsect1>

</refentry>

⌨️ 快捷键说明

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