Minor - formatting code, fixing PHP warnings.

1.9.x
Julio Montoya 12 years ago
parent e7c083de0c
commit cc720b5c36
  1. 4
      main/inc/lib/pdf.lib.php
  2. 2
      main/inc/lib/pear/HTML/Common.php
  3. 14
      main/inc/lib/pear/HTML/QuickForm.php
  4. 184
      main/inc/lib/pear/HTML/QuickForm/date.php
  5. 8
      main/inc/lib/pear/HTML/QuickForm/element.php
  6. 18
      main/inc/lib/pear/Text/Diff.php
  7. 2
      main/inc/lib/userportal.lib.php

@ -291,7 +291,7 @@ class PDF
$clean_search = array (
'@<script[^>]*?>.*?</script>@si',
'@<style[^>]*?>.*?</style>@siU'
);
);
// Formatting the pdf
$course_data = api_get_course_info($course_code);
@ -355,7 +355,7 @@ class PDF
if (!empty($css)) {
$this->pdf->WriteHTML($css, 1);
}
$this->pdf->WriteHTML($document_html,2);
$this->pdf->WriteHTML($document_html, 2);
if (empty($pdf_name)) {
$output_file = 'pdf_'.date('Y-m-d-his').'.pdf';

@ -471,4 +471,4 @@ class HTML_Common
return $charset;
} // end func charset
} // end class HTML_Common
?>
?>

@ -668,13 +668,20 @@ class HTML_QuickForm extends HTML_Common
// Add the element if it is not an incompatible duplicate
if (!empty($elementName) && isset($this->_elementIndex[$elementName])) {
if ($this->_elements[$this->_elementIndex[$elementName]]->getType() ==
$elementObject->getType()) {
if ($this->_elements[$this->_elementIndex[$elementName]]->getType() == $elementObject->getType()
) {
$this->_elements[] =& $elementObject;
$elKeys = array_keys($this->_elements);
$this->_duplicateIndex[$elementName][] = end($elKeys);
} else {
$error = PEAR::raiseError(null, QUICKFORM_INVALID_ELEMENT_NAME, null, E_USER_WARNING, "Element '$elementName' already exists in HTML_QuickForm::addElement()", 'HTML_QuickForm_Error', true);
$error = PEAR::raiseError(
null,
QUICKFORM_INVALID_ELEMENT_NAME,
null,
E_USER_WARNING,
"Element '$elementName' already exists in HTML_QuickForm::addElement()", 'HTML_QuickForm_Error',
true
);
return $error;
}
} else {
@ -682,6 +689,7 @@ class HTML_QuickForm extends HTML_Common
$elKeys = array_keys($this->_elements);
$this->_elementIndex[$elementName] = end($elKeys);
}
if ($this->_freezeAll) {
$elementObject->freeze();
}

@ -1,33 +1,33 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Class for a group of elements used to input dates (and times).
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.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_QuickForm
* @author Alexey Borzov <avb@php.net>
* @copyright 2001-2009 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: date.php,v 1.62 2009/04/04 21:34:02 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm
*/
/**
* Class for a group of form elements
*/
/**
* Class for a group of elements used to input dates (and times).
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.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_QuickForm
* @author Alexey Borzov <avb@php.net>
* @copyright 2001-2009 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id: date.php,v 1.62 2009/04/04 21:34:02 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm
*/
/**
* Class for a group of form elements
*/
require_once 'HTML/QuickForm/group.php';
/**
* Class for <select></select> elements
*/
/**
* Class for <select></select> elements
*/
require_once 'HTML/QuickForm/select.php';
/**
@ -36,11 +36,11 @@ require_once 'HTML/QuickForm/select.php';
* Inspired by original 'date' element but reimplemented as a subclass
* of HTML_QuickForm_group
*
* @category HTML
* @package HTML_QuickForm
* @author Alexey Borzov <avb@php.net>
* @version Release: 3.2.11
* @since 3.1
* @category HTML
* @package HTML_QuickForm
* @author Alexey Borzov <avb@php.net>
* @version Release: 3.2.11
* @since 3.1
*/
class HTML_QuickForm_date extends HTML_QuickForm_group
{
@ -80,19 +80,19 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
* @var array
*/
var $_locale = array(
'en' => array (
'en' => array (
'weekdays_short'=> array ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'),
'weekdays_long' => array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
'months_long' => array ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
),
'de' => array (
'de' => array (
'weekdays_short'=> array ('So', 'Mon', 'Di', 'Mi', 'Do', 'Fr', 'Sa'),
'weekdays_long' => array ('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'),
'months_short' => array ('Jan', 'Feb', 'M&#xe4;rz', 'April', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'),
'months_long' => array ('Januar', 'Februar', 'M&#xe4;rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember')
),
'fr' => array (
'fr' => array (
'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'),
'weekdays_long' => array ('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'),
'months_short' => array ('Jan', 'F&#xe9;v', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Ao&#xfb;t', 'Sep', 'Oct', 'Nov', 'D&#xe9;c'),
@ -244,34 +244,34 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
/**
* Class constructor
*
* The following keys may appear in $options array:
* - 'language': date language
* - 'format': Format of the date, based on PHP's date() function.
* The following characters are currently recognised in format string:
* <pre>
* D => Short names of days
* l => Long names of days
* d => Day numbers
* M => Short names of months
* F => Long names of months
* m => Month numbers
* Y => Four digit year
* y => Two digit year
* h => 12 hour format
* H => 23 hour format
* i => Minutes
* s => Seconds
* a => am/pm
* A => AM/PM
* </pre>
* - 'minYear': Minimum year in year select
* - 'maxYear': Maximum year in year select
* - 'addEmptyOption': Should an empty option be added to the top of
* each select box?
* - 'emptyOptionValue': The value passed by the empty option.
* - 'emptyOptionText': The text displayed for the empty option.
* - 'optionIncrement': Step to increase the option values by (works for 'i' and 's')
*
* The following keys may appear in $options array:
* - 'language': date language
* - 'format': Format of the date, based on PHP's date() function.
* The following characters are currently recognised in format string:
* <pre>
* D => Short names of days
* l => Long names of days
* d => Day numbers
* M => Short names of months
* F => Long names of months
* m => Month numbers
* Y => Four digit year
* y => Two digit year
* h => 12 hour format
* H => 23 hour format
* i => Minutes
* s => Seconds
* a => am/pm
* A => AM/PM
* </pre>
* - 'minYear': Minimum year in year select
* - 'maxYear': Maximum year in year select
* - 'addEmptyOption': Should an empty option be added to the top of
* each select box?
* - 'emptyOptionValue': The value passed by the empty option.
* - 'emptyOptionText': The text displayed for the empty option.
* - 'optionIncrement': Step to increase the option values by (works for 'i' and 's')
*
* @access public
* @param string Element's name
* @param mixed Label(s) for an element
@ -305,9 +305,6 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
}
}
// }}}
// {{{ _createElements()
function _createElements()
{
$this->_separator = $this->_elements = array();
@ -315,8 +312,6 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
$locale =& $this->_locale[$this->_options['language']];
$backslash = false;
// Modified by Ivan Tcholakov, 16-MAR-2010.
//for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
// $sign = $this->_options['format']{$i};
for ($i = 0, $length = api_strlen($this->_options['format']); $i < $length; $i++) {
$sign = api_substr($this->_options['format'], $i, 1);
//
@ -444,24 +439,24 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
}
// }}}
// {{{ _trimLeadingZeros()
/**
* Trims leading zeros from the (numeric) string
*
* @param string A numeric string, possibly with leading zeros
* @return string String with leading zeros removed
*/
function _trimLeadingZeros($str)
{
if (0 == strcmp($str, $this->_options['emptyOptionValue'])) {
return $str;
}
$trimmed = ltrim($str, '0');
return strlen($trimmed)? $trimmed: '0';
}
// }}}
// {{{ _trimLeadingZeros()
/**
* Trims leading zeros from the (numeric) string
*
* @param string A numeric string, possibly with leading zeros
* @return string String with leading zeros removed
*/
function _trimLeadingZeros($str)
{
if (0 == strcmp($str, $this->_options['emptyOptionValue'])) {
return $str;
}
$trimmed = ltrim($str, '0');
return strlen($trimmed)? $trimmed: '0';
}
// }}}
// {{{ setValue()
function setValue($value)
@ -473,7 +468,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
$value = strtotime($value);
}
// might be a unix epoch, then we fill all possible values
$arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value));
$arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value));
$value = array(
'D' => $arr[0],
'l' => $arr[0],
@ -486,14 +481,14 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
'h' => $arr[4],
'g' => $arr[4],
'H' => $arr[5],
'i' => $this->_trimLeadingZeros($arr[6]),
's' => $this->_trimLeadingZeros($arr[7]),
'i' => $this->_trimLeadingZeros($arr[6]),
's' => $this->_trimLeadingZeros($arr[7]),
'a' => $arr[8],
'A' => $arr[9],
'W' => $this->_trimLeadingZeros($arr[10])
'W' => $this->_trimLeadingZeros($arr[10])
);
} else {
$value = array_map(array($this, '_trimLeadingZeros'), $value);
} else {
$value = array_map(array($this, '_trimLeadingZeros'), $value);
}
parent::setValue($value);
}
@ -503,7 +498,7 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
function toHtml()
{
include_once('HTML/QuickForm/Renderer/Default.php');
include_once 'HTML/QuickForm/Renderer/Default.php';
$renderer = new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
parent::accept($renderer);
@ -531,7 +526,4 @@ class HTML_QuickForm_date extends HTML_QuickForm_group
return parent::onQuickFormEvent($event, $arg, $caller);
}
}
// }}}
}
?>

@ -89,7 +89,7 @@ class HTML_QuickForm_element extends HTML_Common
* @access public
* @return void
*/
function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null)
function HTML_QuickForm_element($elementName = null, $elementLabel = null, $attributes = null)
{
HTML_Common::HTML_Common($attributes);
if (isset($elementName)) {
@ -238,7 +238,7 @@ class HTML_QuickForm_element extends HTML_Common
// Modified by Ivan Tcholakov, 16-MAR-2010.
//return ('' != $value? htmlspecialchars($value): '&nbsp;') .
// $this->_getPersistantData();
$value = ('' != $value ? @htmlspecialchars($value, ENT_COMPAT, HTML_Common::charset()): '&nbsp;') .
$this->_getPersistantData();
return '<span class="freeze">'.$value.'</span>';
@ -378,7 +378,7 @@ class HTML_QuickForm_element extends HTML_Common
switch ($event) {
case 'createElement':
$className = get_class($this);
$this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
break;
case 'addElement':
@ -498,4 +498,4 @@ class HTML_QuickForm_element extends HTML_Common
// }}}
} // end class HTML_QuickForm_element
?>
?>

@ -17,7 +17,8 @@
* @package Text_Diff
* @author Geoffrey T. Dairiki <dairiki@dairiki.org>
*/
class Text_Diff {
class Text_Diff
{
/**
* Array of changes.
@ -380,10 +381,9 @@ class Text_Diff_Op_copy extends Text_Diff_Op {
function &reverse()
{
$reverse = &new Text_Diff_Op_copy($this->final, $this->orig);
$reverse = new Text_Diff_Op_copy($this->final, $this->orig);
return $reverse;
}
}
/**
@ -392,7 +392,8 @@ class Text_Diff_Op_copy extends Text_Diff_Op {
*
* @access private
*/
class Text_Diff_Op_delete extends Text_Diff_Op {
class Text_Diff_Op_delete extends Text_Diff_Op
{
function Text_Diff_Op_delete($lines)
{
@ -402,7 +403,7 @@ class Text_Diff_Op_delete extends Text_Diff_Op {
function &reverse()
{
$reverse = &new Text_Diff_Op_add($this->orig);
$reverse = new Text_Diff_Op_add($this->orig);
return $reverse;
}
@ -424,7 +425,7 @@ class Text_Diff_Op_add extends Text_Diff_Op {
function &reverse()
{
$reverse = &new Text_Diff_Op_delete($this->final);
$reverse = new Text_Diff_Op_delete($this->final);
return $reverse;
}
@ -436,7 +437,8 @@ class Text_Diff_Op_add extends Text_Diff_Op {
*
* @access private
*/
class Text_Diff_Op_change extends Text_Diff_Op {
class Text_Diff_Op_change extends Text_Diff_Op
{
function Text_Diff_Op_change($orig, $final)
{
@ -446,7 +448,7 @@ class Text_Diff_Op_change extends Text_Diff_Op {
function &reverse()
{
$reverse = &new Text_Diff_Op_change($this->final, $this->orig);
$reverse = new Text_Diff_Op_change($this->final, $this->orig);
return $reverse;
}

@ -1100,7 +1100,7 @@ class IndexManager
}
$date_session_start = $session['date_start'];
$date_session_end = $session['date_end'];
$days_access_before_beginning = $session['nb_days_access_before_beginning'];
$days_access_before_beginning = $session['nb_days_access_before_beginning'];
$days_access_after_end = $session['nb_days_access_after_end'];
$session_now = time();

Loading…
Cancel
Save